import java.util.Scanner;
public class diskon{
public static void main(String[]args){
double total,diskon,bayar;
String hadiah,potongan;
Scanner S = new Scanner (System.in);
System.out.println("==========================================");
System.out.println("== Gus__Srack Corporation System Diskon ==");
System.out.println(" == \t Nama : Gus Wihananto \t ==");
System.out.println(" == \t NPM : 201043500997 \t ==");
System.out.println("==========================================");
System.out.println();
System.out.print("Masukkan Total Belanjaan Anda = Rp.");
total = S.nextDouble();
if (total >= 1000000){
potongan ="20%";
diskon = total * 0.2;
bayar = total - diskon;
hadiah ="Payung";
}
else if (total >= 500000){
potongan ="15%";
diskon = total * 0.15;
bayar = total - diskon;
hadiah ="Piring";
}
else if (total >= 200000){
potongan ="10%";
diskon = total * 0.1;
bayar = total - diskon;
hadiah ="Gelas";
}
else {
potongan ="0";
diskon = total*0;
bayar = total - diskon;
hadiah ="Terima Kasih";
}
System.out.println();
System.out.println("==========================================");
System.out.println("Total Belanja Sebelum Diskon : Rp." +total);
System.out.println("Potongan Diskon : " +potongan );
System.out.println("Diskon yang Saudara peroleh : Rp." +diskon);
System.out.println("==========================================");
System.out.println("Biaya yang harus Anda bayar : Rp." +bayar);
System.out.println("==========================================");
System.out.println("Hadiah Belanja : " +hadiah);
}
}
OUTPUT :
public class diskon{
public static void main(String[]args){
double total,diskon,bayar;
String hadiah,potongan;
Scanner S = new Scanner (System.in);
System.out.println("==========================================");
System.out.println("== Gus__Srack Corporation System Diskon ==");
System.out.println(" == \t Nama : Gus Wihananto \t ==");
System.out.println(" == \t NPM : 201043500997 \t ==");
System.out.println("==========================================");
System.out.println();
System.out.print("Masukkan Total Belanjaan Anda = Rp.");
total = S.nextDouble();
if (total >= 1000000){
potongan ="20%";
diskon = total * 0.2;
bayar = total - diskon;
hadiah ="Payung";
}
else if (total >= 500000){
potongan ="15%";
diskon = total * 0.15;
bayar = total - diskon;
hadiah ="Piring";
}
else if (total >= 200000){
potongan ="10%";
diskon = total * 0.1;
bayar = total - diskon;
hadiah ="Gelas";
}
else {
potongan ="0";
diskon = total*0;
bayar = total - diskon;
hadiah ="Terima Kasih";
}
System.out.println();
System.out.println("==========================================");
System.out.println("Total Belanja Sebelum Diskon : Rp." +total);
System.out.println("Potongan Diskon : " +potongan );
System.out.println("Diskon yang Saudara peroleh : Rp." +diskon);
System.out.println("==========================================");
System.out.println("Biaya yang harus Anda bayar : Rp." +bayar);
System.out.println("==========================================");
System.out.println("Hadiah Belanja : " +hadiah);
}
}
OUTPUT :
No comments:
Post a Comment