Kode IDelivery
/**
* Class OnlineShop
*/
import java.util.Scanner;
public class IDelivery
{
private String nama_pemesan_;
private String barang_;
private int harga_barang_;
private int jumlah_barang_;
private int kode_barang_;
private String alamat_pengiriman_;
private String nomor_hp_;
Scanner scan = new Scanner(System.in);
public void bayarIDelivery()
{
System.out.println("Masukkan Nama Pemesan :");
nama_pemesan_ = scan.next();
System.out.println("\n");
System.out.println("Masukkan Nomor HP :");
nama_pemesan_ = scan.next();
System.out.println("\n");
System.out.println("Masukkan Alamat Pengiriman :");
alamat_pengiriman_ = scan.nextLine();
System.out.println("\n");
System.out.println("Pilih Barang");
System.out.println("");
System.out.println("1. AQUA GALON (18000)");
System.out.println("2. GAS (20000)");
System.out.println("3. AQUA GELAS KARDUS (20000)");
kode_barang_ = scan.nextInt();
switch(kode_barang_)
{
case 1:
barang_ = "AQUA GALON";
harga_barang_ = 18000;
break;
case 2:
barang_ = "GAS";
harga_barang_ = 20000;
break;
case 3:
barang_ = "AQUA GELAS KARDUS";
harga_barang_ = 30000;
break;
}
System.out.println("Masukkan Jumlah Barang");
jumlah_barang_ = scan.nextInt();
hitungHarga();
printNota();
}
public void hitungHarga()
{
harga_barang_ = harga_barang_ * jumlah_barang_;
}
public void printNota()
{
System.out.println("\n");
System.out.println("I-Kios");
System.out.println("IDelivery");
System.out.println("Nama Pemesan : " + nama_pemesan_ );
System.out.println("Nomor HP : " + nomor_hp_ );
System.out.println("Alamat : " + alamat_pengiriman_);
System.out.println("Nama Barang : " + barang_);
System.out.println("Jumlah Barang : " + jumlah_barang_);
System.out.println("Harga : " + harga_barang_);
System.out.println("\n");
}
}
Komentar
Posting Komentar