Source Code Java NetBeans : Penjualan Barang Dagangan
package penjualanbarangdagangkumpulanartikel.pkg21.blogspot.com;
import java.util.Scanner ;
public class PenjualanBarangDagangKumpulanArtikel21BlogspotCom {
public static void main(String[] args) {
Scanner masukan= new Scanner(System.in);
int pb,totalharga,bb,diskon,uangb,kembalian;
int harga = 0,totbayar = 0;
System.out.println("|\t\tPenjualan makanan ringan\t\t\t|");
System.out.println("|-----------------------------------------------|");
System.out.println("|\tBARANG\t\t|\tHARGA\t\t|");
System.out.println("|-----------------------------------------------|");
System.out.println("|\t1.batagor\t| Rp.1500/Bungkus|");
System.out.println("|\t2.baso_tahu\t| Rp.1500/Bungkus|");
System.out.println("|\t3.taikwan\t| Rp.2000/Bungkus|");
System.out.println("|-----------------------------------------------|");
System.out.print("Barang yang anda Beli [1/2/3]:");
pb=masukan.nextInt();
{
if(pb==1)
{System.out.println("Nama barang : Batagor");
harga=1500;
System.out.print("Harga :"+harga);}
if(pb==2)
{System.out.println("Nama barang : Baso_tahu");
harga=1500;
System.out.print("Harga :"+harga);}
if(pb==3)
{System.out.println("Nama barang : Taikwan");
harga=2000;
System.out.print("Harga :"+harga);}
}
System.out.print("\nBanyak barang yang dibeli:");
bb=masukan.nextInt();
totalharga= harga*bb;
diskon=totalharga*5/100;
System.out.println();
System.out.println("Total harga=RP."+totalharga);
System.out.println("Diskon(5%)=RP."+diskon);
totbayar=totalharga-diskon;
System.out.println("Total Bayar=Rp."+totbayar);
System.out.print("Uang Bayar anda=Rp.");
uangb=masukan.nextInt();
kembalian=uangb-totbayar;
System.out.println("Kembalian=RP."+kembalian);
System.out.println(" KumpulanArtikel-21.blogspot.com");
}
}
Output :