1. Listing
/**
* @(#)agensusu.java
*
*
* @author
* @version 1.00 2012/4/1
*/
import java.util.*;
public class agensusu {
public static void main(String [] args)
{
double hasil,harga,jumbel;
String merk,ukuran,kode;
Scanner input=new Scanner(System.in);
System.out.println("TOKO KELONTONG KERONCONGAN ");
System.out.println("==================================");
System.out.println("A. Susu Dancow");
System.out.println(" 1.Ukuran Kecil");
System.out.println(" 2.Ukuran Sedang");
System.out.println(" 3.Ukuran Besar");
System.out.println("B. Susu Bendera");
System.out.println(" 1.Ukuran Kecil");
System.out.println(" 2.Ukuran Sedang");
System.out.println(" 3.Ukuran Besar");
System.out.println("C. Susu SGM");
System.out.println(" 1.Ukuran Kecil");
System.out.println(" 2.Ukuran Sedang");
System.out.println(" 3.Ukuran Besar");
System.out.print("Input Kode Susu [1/2/3] : " );
kode=input.nextLine();
System.out.print("Input Ukuran Kaleng susu [K/S/B] : " );
ukuran=input.nextLine();
if (kode =="1")
{
if(ukuran=="K")
harga=25000;
else if(ukuran=="S")
harga=20000;
else
harga=15000;
merk="Dancow";
}
else if (kode=="2")
{
merk="Bendera";
if(ukuran=="K")
harga=20000;
else if(ukuran=="S")
harga=17500;
else
harga=13500;
}
else
{
merk="SGM";
if(ukuran=="K")
harga=22000;
else if(ukuran=="S")
harga=18500;
else
harga=17000;
}
System.out.println("Merk Susu :"+ merk);
System.out.println("Ukuran :"+ ukuran);
System.out.println("Harga Satuan Barang :"+harga);
System.out.print("Jumlah yang di beli : " );
jumbel=input.nextDouble();
hasil=jumbel*harga;
System.out.println("Harga yang harus di bayar : "+hasil );
}
}
2. Hasil
Tidak ada komentar:
Posting Komentar