Social Icons

Cara mendapatkan bitcoin gratis

Sunday, 7 September 2014

program Diskon Barang


Source Code :

public class Jawaban{
public static void main (String [] args){
int kode, harga, diskon;
String jenis;
String sDiskon;

System.out.print("KODE  : ");
kode = Integer.parseInt(System.console().readLine());

System.out.print("JENIS : ");
jenis = System.console().readLine();

System.out.print("HARGA : ");
harga = Integer.parseInt(System.console().readLine());

if(jenis.toUpperCase().equals("A"))
{
diskon = harga * 10 / 100;
sDiskon = "10%";
}
else if(jenis.toUpperCase().equals("B"))
{
diskon = harga * 15 / 100;
sDiskon = "15%";
}
else if(jenis.toUpperCase().equals("C"))
{
diskon = harga * 20 / 100;
sDiskon = "20%";
}
else
{
diskon = 0;
sDiskon = "0%";
}

harga = harga - diskon;
System.out.print("Jenis barang " + jenis.toUpperCase());
System.out.print(" Mendapatkan diskon = " + sDiskon);
System.out.print(" Harga setelah didiskon " + harga);
}
}


Outputnya :


No comments:

Post a Comment

jago Photoshop