import java.io.*;
public class barangbarang{
public static void main(String [] args){
double total,TotalBayar,hasil,Dis,total2;
String Keterangan;
try {
BufferedReader nilai = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Masukan Nama Barang : ");
String input = nilai.readLine();
BufferedReader nilai2= new BufferedReader( new InputStreamReader( System.in));
System.out.print("Harga Barang : ");
String input2 = nilai2.readLine();
double harga = Integer.parseInt(input2);
BufferedReader nilai3= new BufferedReader( new InputStreamReader( System.in));
System.out.print("Banyaknya Barang : ");
String input3 = nilai3.readLine();
double banyaknya = Integer.parseInt(input3);
BufferedReader nilai4= new BufferedReader( new InputStreamReader( System.in));
System.out.print("Jumlah Uang Muka : ");
String input4 = nilai4.readLine();
double juangMuka = Integer.parseInt(input4);
total=harga*banyaknya-juangMuka;
total2=total*0.05;
if (total >= 500000){
Keterangan="Discount 10%";
Dis=total*0.1;
TotalBayar=total-Dis;}
else {
Keterangan="Anda Tidak Mendapatkan Diskon";
TotalBayar=total;}
System.out.println("=========================================================");
System.out.println("");
System.out.println("Nama Barang : "+input);
System.out.println("Harga Barang : RP. "+harga);
System.out.println("Jumlah Uang Muka : RP"+juangMuka);
System.out.println("=========================================================");
System.out.println("Sisa Yang Harus Di bayar : RP."+total);
System.out.println("Sub Total Belanja2 : RP."+total2);
System.out.println(Keterangan);
System.out.println("Jumlah Yang harus Anda Bayar : RP."+TotalBayar);
System.out.println("=========================================================");
System.out.println("Terima Kasih Atas kunjungan Anda");
} catch (IOException e) {
e.printStackTrace();
}// end try
}
}
Categories:
java