program kasir kali ini berisi beberapa opsi diskon tergantung rentang harga totalnya,
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Kuliah;
/**
*
* @author ynrhk
*/
import java.util.Scanner;
public class ifelse {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
int jmlbarang, harga1, tp;
double hrsdibayar, hargadiskon = 0, cash, kembali;
System.out.println("Kam-Shirt Store");
System.out.println("Choose your color with the same price");
System.out.print("Jumlah barang : ");
jmlbarang = sc.nextInt();
System.out.print("Harga satuan : Rp. ");
harga1 = sc.nextInt();
tp = jmlbarang*harga1;
System.out.println("Total pembelian : Rp. "+tp);
//pemberian diskon
System.out.print("Diskon : ");
if (tp<= 100000) {
System.out.println("0%");
System.out.println("TOTAL : Rp. "+tp);
}else if (100000<tp && tp<=200000){
System.out.println("5%");
hargadiskon = tp-(tp*0.05);
System.out.println("TOTAL : Rp. "+hargadiskon);
}else if (200000<tp && tp<=300000){
System.out.println("10%");
hargadiskon = tp-(tp*0.1);
System.out.println("TOTAL : Rp. "+hargadiskon);
}else if (300000<tp && tp<=400000){
System.out.println("15%");
hargadiskon = tp-(tp*0.15);
System.out.println("TOTAL : Rp. "+hargadiskon);
}else if (400000<tp && tp<=500000){
System.out.println("20%");
hargadiskon = tp-(tp*0.2);
System.out.println("TOTAL : Rp. "+hargadiskon);
} else if (tp>500000) {
System.out.println("25%%");
hargadiskon = tp-(tp*0.25);
System.out.println("TOTAL : Rp. "+hargadiskon);
} else {
System.out.println("masukan salah");}
//pembayaran
System.out.print("Cash : Rp. ");
cash = sc.nextDouble();
kembali = cash-hargadiskon;
if (kembali==0){
System.out.println(" uang pas ");
} else
System.out.println("Kembali : Rp. "+kembali);
System.out.println(" Thanks for Shopping ");}
}