Monday, November 10, 2014

Pemograman With Database

7:41 PM Posted by beckti'velu No comments
package database_menu;

import java.sql.DriverManager;
import java.util.Scanner;
import java.sql.*;

public class Database_menu {

    public static void main(String[] args) {
    try{
        int pilihan = 0;
        Scanner input = new Scanner(System.in);
        Class.forName ("com.mysql.jdbc.Driver");
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/pd2", "root", "");
        Statement stmt = conn.createStatement();
        while (pilihan!=5) {
        System.out.println("1. View (Select");
        System.out.println("2. Insert");
        System.out.println("3. Edit (Update");
        System.out.println("4. Delete");
        System.out.println("5. Exit");
        System.out.print("Pilihan : ");
        pilihan = input.nextInt();
       
        if (pilihan==1){
            ResultSet rs = stmt.executeQuery("SELECT * FROM lagu");
            while (rs.next()){
                System.out.println(rs.getString("id")+" - "+rs.getString("judul")+" - "+rs.getString("penyanyi"));
            }
        }else if (pilihan==2) {
            System.out.print("Judul : ");
            String judul = new Scanner(System.in).nextLine();
            System.out.print("Penyanyi : ");
            String penyanyi = new Scanner(System.in).nextLine();
            String sql = "INSERT INTO lagu (judul,penyanyi)"+ "VALUES('"+judul+"','"+penyanyi+"')";
            stmt.executeUpdate(sql);
           
        }else if (pilihan==3){
            System.out.print("Id yang akan di ubah : ");
            String id = new Scanner(System.in).nextLine();
            ResultSet rs = stmt.executeQuery("SELECT * FROM lagu " + "WHERE id"+id);
            rs.first();
            String judul_lama = rs.getString("judul");
            String penyanyi_lama = rs.getString("penyanyi");
            System.out.print("Judul : ");
            String judul = new Scanner(System.in).nextLine();
            System.out.print("Penyanyi : ");
            String penyanyi = new Scanner(System.in).nextLine();
            String sql = "UPDATE lagu SET judul='"+judul+"'," + "penyanyi= '"+penyanyi+"' WHERE id='"+id;
            stmt.executeUpdate(sql);
        }
    }
   
}catch (Exception e) {
        System.out.println(e.getLocalizedMessage());
    }
    }
   
}

Link database : http://www.4shared.com/document/HVCqfzbece/lagu.html

Sunday, September 28, 2014

Contoh Double Linked List

11:39 PM Posted by beckti'velu No comments
package contoh;

public class Contoh {
public static class t_dll_node {
    float data;
    t_dll_node prev, next;
}
public static t_dll_node NodeAwal, NodeAkhir;

Array Mahasiswa Dengan Scanner (Method)

5:29 AM Posted by beckti'velu No comments
package modif.array;

import java.util.Scanner;

public class ModifArray {
    public static String [] nrp = new String [100];
    public static String [] nama = new String [100];
    public static String [] nilai = new String [100];
    public static int data;

Cetak Array Dari Belakang

1:49 AM Posted by beckti'velu No comments
package modif.array;

public class ModifArray {
    public static final int MaxMyArrayLength = 10;
    public static int PanjangMyArray = 0;
    public static int MyArray[] = new int [MaxMyArrayLength];
 
    public static boolean insertArray (int Data) {
    MyArray[PanjangMyArray] = Data;
    PanjangMyArray++;
    return true;
    }

Monday, September 15, 2014

Contoh Double Linked List Java Netbeans

8:39 PM Posted by beckti'velu No comments
package javaapplication6;

class Node {
    String data;
    Node prev;
    Node next;
    void info() {
        System.out.println(" ");
        System.out.println("Data :"+this.data);
        System.out.println("Alamat "+this);
     
    }
 
}

Contoh Class Java Netbeans

7:54 PM Posted by beckti'velu No comments
package javaapplication6;

class Serigala {
    public String nama;
    public String warna_bulu;
    public void mengaung () {
        System.out.println("Auuuuuu");
    }

Friday, July 18, 2014

Kunci Gitar Billfold Abaikan

7:52 PM Posted by beckti'velu 2 comments

E                                 A
Terniang dua bisikan ditelingaku
C#m
Takkan mampu merubah semua waktu,
B
Dan lihatlah diriku disini akan berdiri menangtangmu
E                                          A
Mengharapkan perubahan, baik dari semua segi datang hanya tuk menggelapkan
C#m                             B
Tapi ku bisa menahan dari satu pandangan
A
Disana melihat dari lebih sempurna,
B
Satu terbuka takkan sanggup untuk segalanya

  E                       A              C#m
Disini ku mengingatkan memperingatkan tuk perubahan
  B
Bukan berarti disini,
  E               A               C#m
Melangkah kegelapan membuka jiwa
     B
Tuk yang tak pasti tak pernah berarti dan ABAIKAN

   E                        A
OO OOOO OOO Hentikan semua
  E                         A
OO OOOOO OO Bual belaka

  E                           C#m                  B                                A         B
Tak pernah berhenti kau anggap ku berkhayal selalu menatap
                               C#m            B                           A
Tak pernah terlelap untukku mengingatkan untuk peringatkan