Jumat, 30 Desember 2011

program diskon sepatu dalam java

import java.util.Scanner;
public class sepatu
{
public static void main(String args[])
{
Scanner masuk = new Scanner(System.in);
int  ukuran,A=180000,B=320000,C=425000;
float hargatotal;
System.out.println(" Pilihan Sepatu A  B  C ");
System.out.println();

System.out.println("Masukkan pilihan sepatu ! ");
String pil = masuk.nextLine();

if(pil.equals("A"))

{
System.out.println("Masukkan ukuran sepatu !");
ukuran = masuk.nextInt();
if (ukuran<37)
{
hargatotal = A+(A*7f/100f);
System.out.println("Harga tambah 7%");
System.out.println("Harga sepatu : "+hargatotal);
}
else if (ukuran>=37 && ukuran <= 40)
{
hargatotal = A-(A*10f/100f);
System.out.println("Diskon 10%");
System.out.println("Harga sepatu : "+hargatotal);
}
else if (ukuran >= 41 && ukuran <=43)
{
hargatotal = A-(A*5f/100f);
System.out.println("Diskon 5%");
System.out.println("Harga sepatu  : "+hargatotal);
}
else
{
System.out.println("Ukuran salah");
}
}
if ( pil.equals("B"))
{
System.out.println("Masukkan ukuran sepatu !");
ukuran = masuk.nextInt();
if (ukuran>=30 && ukuran<=35)
{
hargatotal = B-(B*40f/100f);
System.out.println("Diskon 40%");
System.out.println("Harga sepatu : "+hargatotal);
}
else if (ukuran>=36 && ukuran <= 40)
{
hargatotal = B-(B*15f/100f);
System.out.println("Diskon 10%");
System.out.println("Harga sepatu : "+hargatotal);
}
else if (ukuran >= 41 && ukuran <=43)
{
hargatotal = B-(B*0f/100f);
System.out.println("Diskon 0%");
System.out.println("Harga sepatu  : "+hargatotal);
}
else
{
System.out.println("Ukuran salah");
}
}
if ( pil.equals("C"))
{
System.out.println("Masukkan ukuran sepatu !");
ukuran = masuk.nextInt();
if (ukuran>=40)
{
hargatotal = C-(C*15f/100f);
System.out.println("Diskon 15%");
System.out.println("Harga sepatu : "+hargatotal);
}
else if (ukuran<40)
{
hargatotal = C-(C*10f/100f);
System.out.println("Diskon 10%");
System.out.println("Harga sepatu  : "+hargatotal);
}
else
{
System.out.println("Ukuran salah");
}
}
}

}

0 komentar:

Posting Komentar

Statistik

Translate

Blog Archive