Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class IDelivery
- {
- private String nama;
- private String barang;
- private int hargaBarang;
- private int jumlahBarang;
- private int kodeBarang;
- private String alamat;
- private String noHP;
- Scanner scan = new Scanner(System.in);
- public void bayarIDelivery()
- {
- System.out.println("Masukkan Nama Pemesan :");
- nama = scan.next();
- System.out.println("\n");
- System.out.println("Masukkan Nomor HP :");
- noHP = scan.next();
- System.out.println("\n");
- System.out.println("Masukkan Alamat Pengiriman :");
- alamat = 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)");
- kodeBarang = scan.nextInt();
- switch(kodeBarang)
- {
- case 1:
- barang = "AQUA GALON";
- hargaBarang = 18000;
- break;
- case 2:
- barang = "GAS";
- hargaBarang = 20000;
- break;
- case 3:
- barang = "AQUA GELAS KARDUS";
- hargaBarang = 30000;
- break;
- }
- System.out.println("Masukkan Jumlah Barang");
- jumlahBarang = scan.nextInt();
- hitungHarga();
- printNota();
- }
- public void hitungHarga()
- {
- hargaBarang = hargaBarang * jumlahBarang;
- }
- public void printNota()
- {
- System.out.println("\n");
- System.out.println("I-Kios");
- System.out.println("IDelivery");
- System.out.println("Nama Pemesan : " + nama);
- System.out.println("Nomor HP : " + noHP );
- System.out.println("Alamat : " + alamat);
- System.out.println("Nama Barang : " + barang);
- System.out.println("Jumlah Barang : " + jumlahBarang);
- System.out.println("Harga : " + hargaBarang);
- System.out.println("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement