Membuat aplikasi maintenance barang sederhana untuk belajar bahasa pemrograman java menggunakan JCreator, atau dapat compile manual.
Source Code:
import java.io.*;class MaintenanceBarang2
{
public static void main(String[]args)throws Exception
{
String[][] barang= new String [5][4];
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
try
{
boolean kondisi;
int pilihan;
do
{
kondisi= false;
System.out.println ("==============================");
System.out.println ("Maintenance Barang");
System.out.println ("==============================");
System.out.println ("1. Tambah Barang");
System.out.println ("2. Detail Barang");
System.out.println ("3. Update Barang");
System.out.println ("4. Keluar");
System.out.println ("==============================");
System.out.print("Pilihan : ");
pilihan = Integer.parseInt(in.readLine());
System.out.println();
int a= 0;
String kode;
switch(pilihan)
{
case 1 :
System.out.println("=====================");
System.out.println("Tambah Barang");
System.out.println("=====================");
do
{
System.out.print("Kode Barang : ");
kode= in.readLine();
if(kode.equals("/"))
kondisi= true;
else
{
barang[a][0] = kode;
System.out.print("Nama Barang : ");
barang [a][1] = in.readLine();
System.out.print("Harga Barang : ");
int harga = Integer.parseInt(in.readLine());
barang [a][2] = in.readLine();
System.out.print("Jumlah : ");
int jumlah = Integer.parseInt(in.readLine());
barang [a][3] = in.readLine();
kondisi = false;
System.out.println();
}
a++;
}
while(kondisi==false);
break;
case 2 :
System.out.println("========================");
System.out.println("Detail Barang");
System.out.println("========================");
System.out.print("Silakan Masukkan Kode Barang : ");
System.out.println("(Ketik \"/\" untuk kembali ke Menu Maintenance Barang)");
do
{
System.out.print("Masukkan Kode Barang : ");
kode = in.readLine();
if(kode.equals("/"))
{
kondisi= true;
}
else
{
for(a=0;a<barang.length;a++)
{
if(kode.equals(barang[a][0]))
{
System.out.println("==================");
System.out.println("Detail Barang");
System.out.println("==================");
System.out.print("Kode Barang : ");
System.out.println(barang[a][0]);
System.out.print("Nama Barang : ");
System.out.println(barang[a][1]);
System.out.print("Harga Barang : ");
System.out.println(barang[a][2]);
System.out.print("Jumlah : ");
System.out.println(barang[a][3]);
}
}
System.out.println();
}
}
while(kondisi==false);
break;
case 3 :
System.out.println("=====================");
System.out.println("Update Barang");
System.out.println("=====================");
do
{
System.out.print("Kode Barang : ");
kode= in.readLine();
if(kode.equals("/"))
kondisi= true;
else
{
barang[a][0] = kode;
System.out.print("Nama Barang : ");
barang[a][1] = in.readLine();
System.out.print("Harga Barang : ");
barang[a][2] = in.readLine();
System.out.print("Jumlah : ");
barang [a][3] = in.readLine();
kondisi= false;
System.out.println();
}
a++;
}
while(kondisi==false);
break;
case 4 :
System.exit(0);
default:
System.out.println("Input Salah");
}
System.out.println();
}
while(kondisi==true);
}
catch(Exception e)
{
System.out.println("Input Salah");
}
}
}
Semoga bermanfaat, Salam berbagi... ;)
Aplikasi Maintenance Barang Java (JCreator)
Reviewed by Unknown
on
2/26/2016
Rating:
No comments: