/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package menghitungPenjualanBarangDiskon;
import javax.swing.*;
/**
*
* @author ANGGA
*/
public class menghitungPenjualanBarangDiskon {
/**
* @param args the command line arguments
*/
public static void main(String[] args){
// TODO code application logic here
int potongan;
short counter=1;
int total = 0;
while(true){
int harga = Integer.parseInt(JOptionPane.showInputDialog(“Masukkan Harga Barang ke “+counter));
total+=harga;
// potongan 10%
potongan=total*90/100;
if(total>=1000000){
System.out.println(“Harga Yang dibayar – barang “+counter+” = “+harga);
System.out.println(“TOTAL (potongan 10%) : Rp.”+potongan);
}
else{
System.out.println(“Harga Yang dibayar – barang “+counter+” = “+harga);
System.out.println(“TOTAL : Rp.”+total);
}
counter++;
}
}
}