FLOWCHART
SOURCE CODE
package pickup_barang;
import java.util.Scanner;
public class Pickup_barang {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
String nama, alamat, tujuan;
int jarak, paket,berat,beratTotal,jarakTotal,biayaPaket,ppn,biayaTotal;
System.out.println (" PROGRAM PICKUP BARANG ");
System.out.println ("-----------------------------");
System.out.print ("Masukkan Nama : ");
nama = input.nextLine();
System.out.print ("Masukkan Alamat : ");
alamat = input.nextLine();
System.out.print ("Masukkan Alamat Pengiriman : ");
tujuan = input.nextLine();
System.out.print ("Masukkan Jarak Pengiriman(km) : ");
jarak = input.nextInt();
System.out.print ("Masukkan Berat Barang(kg) : ");
berat = input.nextInt();
System.out.println ("Menu Layanan : \n <1>Paket Reguler\n <2>Paket Khusus\n <3>Paket VIP" );
System.out.print ("Masukkan Pilihan : ");
paket = input.nextInt();
System.out.println ("\n-----------------------------");
System.out.println ("Nama : "+nama);
System.out.println ("Alamat : "+alamat);
System.out.println ("Alamat Pengiriman : "+tujuan);
System.out.println ("Jarak Pengiriman : "+jarak+" Km");
System.out.println ("Berat Barang : "+berat+" Kg");
switch (paket) {
case 1:
beratTotal=berat*10000;
jarakTotal=jarak*20000;
biayaPaket=beratTotal+jarakTotal;
ppn=biayaPaket*10/100;
biayaTotal=biayaPaket+ppn;
System.out.println ("Total Biaya Kg : "+beratTotal);
System.out.println ("Total Biaya Km : "+jarakTotal);
System.out.println ("Nilai PPN 10% : "+ppn);
System.out.println ("Biaya Total : "+biayaTotal);
break;
case 2:
beratTotal=berat*20000;
jarakTotal=jarak*35000;
biayaPaket=beratTotal+jarakTotal;
ppn=biayaPaket*10/100;
biayaTotal=biayaPaket+ppn;
System.out.println ("Total Biaya Kg : "+beratTotal);
System.out.println ("Total Biaya Km : "+jarakTotal);
System.out.println ("Nilai PPN 10% : "+ppn);
System.out.println ("Biaya Total : "+biayaTotal);
break;
case 3:
beratTotal=berat*30000;
jarakTotal=jarak*50000;
biayaPaket=beratTotal+jarakTotal;
ppn=biayaPaket*10/100;
biayaTotal=biayaPaket+ppn;
System.out.println ("Total Biaya Kg : "+beratTotal);
System.out.println ("Total Biaya Km : "+jarakTotal);
System.out.println ("Nilai PPN 10% : "+ppn);
System.out.println ("Biaya Total : "+biayaTotal);
break;
default:
break;
}
}
}
Tidak ada komentar:
Posting Komentar