import java.io.*;
public class MiniMarket2
{
public static void main(String args[])
{
int C,D,E,F;
try
{
BufferedReader nilai = new BufferedReader (new InputStreamReader (System.in)); System.out.println(" ");
System.out.println(" ");
System.out.println("=======Mini Market Rugi=======");
System.out.println("==============================");
System.out.println(" ");
System.out.print("Nama Barang = ");
String input1=nilai.readLine();
BufferedReader nilaiA = new BufferedReader (new InputStreamReader (System.in)); System.out.print("Harga Barang = ");
String input2=nilai.readLine();
int A=Integer.parseInt(input2);
BufferedReader nilaiB = new BufferedReader (new InputStreamReader (System.in)); System.out.print("Quantity = ");
String input3=nilai.readLine();
int B=Integer.parseInt(input3);
C = A * B;
System.out.println(" "); System.out.println("=============================="); System.out.println(" ");
System.out.println("Total = Rp "+C+",00");
if (B >= 50)
D = 20;
else
if (B >= 20)
D = 10;
else
if (B >= 10)
D = 5;
else
if (B >= 5)
D = 2;
else
D = 0;
System.out.println("Discount = "+D+"%");
System.out.println(" "); System.out.println("=============================="); System.out.println(" ");
if (B >= 50)
{
E = C / 100 * 20;
F = C - E;
}
else
if (B >= 20)
{
E = C / 100 * 10;
F = C - E;
}
else
if (B >= 10)
{
E = C / 100 * 5;
F = C - E;
}
else
if (B >= 5)
{
E = C / 100 * 2;
F = C - E;
}
else
F = C;
System.out.println("Total Bayar = Rp "+F+",00");
System.out.println(" ");
System.out.println("Trima Kasih Atas Kunjungan Anda");
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
Categories:
java