import javax.swing.JOptionPane;
public class MiniMarket3
{
public static void main(String args[])
{
String A;
String B1;
String C1;
int B;
int C;
int D;
int E;
int F;
String H;
int G;
A = JOptionPane.showInputDialog("MINI MARKET RUGI\n \nNama Barang");
B1 = JOptionPane.showInputDialog("MINI MARKET RUGI\n \nHarga Barang");
C1 = JOptionPane.showInputDialog("MINI MARKET RUGI\n \nQuantity");
B = Integer.parseInt(B1);
C = Integer.parseInt(C1);
D = B * C;
if (C >= 50)
{
F = D / 100 * 20;
G = D - F;
H = " \n \n========\"Mini Market Rugi\"========\n===============================\nNama Barang = "+A+"\nHarga Barang = "+B+"\nQuantity = "+C+"\n===============================\nTotal = Rp "+D+",00\nDiscount = 20%\n \n===============================\nTotal Bayar = Rp "+G+",00\n \nTrima Kasih Atas Kunjungan Anda";
}
else
if (C >= 20)
{
F = D / 100 * 10;
G = D - F;
H = " \n \n========\"Mini Market Rugi\"========\n===============================\nNama Barang = "+A+"\nHarga Barang = "+B+"\nQuantity = "+C+"\n===============================\nTotal = Rp "+D+",00\nDiscount = 10%\n \n===============================\nTotal Bayar = Rp "+G+",00\n \nTrima Kasih Atas Kunjungan Anda";
}
else
if (C >= 10)
{
F = D / 100 * 5;
G = D - F;
H = " \n \n========\"Mini Market Rugi\"========\n===============================\nNama Barang = "+A+"\nHarga Barang = "+B+"\nQuantity = "+C+"\n===============================\nTotal = Rp "+D+",00\nDiscount = 5%\n \n===============================\nTotal Bayar = Rp "+G+",00\n \nTrima Kasih Atas Kunjungan Anda";
}
else
if (C >= 5)
{
F = D / 100 * 2;
G = D - F;
H = " \n \n========\"Mini Market Rugi\"========\n===============================\nNama Barang = "+A+"\nHarga Barang = "+B+"\nQuantity = "+C+"\n===============================\nTotal = Rp "+D+",00\nDiscount = 2%\n \n===============================\nTotal Bayar = Rp "+G+",00\n \nTrima Kasih Atas Kunjungan Anda";
}
else
{
G = D;
H = " \n \n========\"Mini Market Rugi\"========\n===============================\nNama Barang = "+A+"\nHarga Barang = "+B+"\nQuantity = "+C+"\n===============================\nTotal = Rp "+D+",00\nDiscount = 0%\n \n===============================\nTotal Bayar = Rp "+G+",00\n \nTrima Kasih Atas Kunjungan Anda";
}
JOptionPane.showMessageDialog(null,H,"TOTAL",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
Categories:
java