import java.io.IOException;
import java.util.Scanner;
public class kasir
{
public static void clear() {
try {
new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
}
catch(Exception e) {
System.out.println(e);
}
}
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int pil = 0;
do {
String barang;
double diskon = 0.0;
double total = 0.0;
int banyak_data = 0, harga = 0, jml = 0, uang = 0;
clear();
System.out.print("Masukkan banyaknya data: ");
banyak_data = input.nextInt();
double[] harga_bayar = new double[banyak_data];
for(int a = 0; a < banyak_data; a++)
{
System.out.print("nData Ke = "+(a+1)+"n");
System.out.print("Masukkan Nama Barang = ");
barang = input.next();
System.out.print("Masukkan Harga Barang = ");
harga = input.nextInt();
System.out.print("Masukkan Jumlah Barang = ");
jml = input.nextInt();
System.out.print("Masukkan Diskon = ");
diskon = input.nextDouble();
harga_bayar[a] = (harga*jml) - (harga*jml*(diskon/100));
}
for(int a = 0; a < banyak_data; a++)
{
total += harga_bayar[a];
}
System.out.println("nTotal Bayar = "+total);
System.out.print("Masukkan jumlah uang = ");
uang = input.nextInt();
System.out.println("Kembalian = "+(uang-total));
System.out.println("Jika ingin transaksi lagi tekan 1");
pil = input.nextInt();
} while(pil == 1);
}
}
Demikian postingan saya kali ini, semoga bermanfaat bila ada pertanyaan silahkan tulis di kolom komentar
0 Comments