If-Bersarang

Run Settings
LanguageJava
Language Version
Run Command
class IfBersarang { public static void main(String[] args) { int kode, harga; String merk, ukuran; //inisiasi nilai kode= 1; harga= 0; merk= ""; ukuran= "m"; if(kode == 1){ merk = "Uniqlo"; if(ukuran=="s" || ukuran=="S"){ harga = 50000; } else if(ukuran=="m" || ukuran=="M"){ harga = 70000; } else if(ukuran=="l" || ukuran=="L"){ harga = 100000; } else{ System.out.println("Ukuran tidak tersedia"); } } else if(kode == 2){ merk = "Nevada"; if(ukuran=="s" || ukuran=="S"){ harga = 60000; } else if(ukuran=="m" || ukuran=="M"){ harga = 75000; } else if(ukuran=="l" || ukuran=="L"){ harga = 105000; } else{ System.out.println("Ukuran tidak tersedia"); } } else if(kode == 3){ merk = "Eiger"; if(ukuran=="s" || ukuran=="S"){ harga = 80000; } else if(ukuran=="m" || ukuran=="M"){ harga = 90000; } else if(ukuran=="l" || ukuran=="L"){ harga = 120000; } else{ System.out.println("Ukuran tidak tersedia"); } } else{ System.out.println("Kode barang tidak tersedia"); } System.out.println("Kode : "+kode); System.out.println("Merk : "+merk); System.out.println("Ukuran : "+ukuran); System.out.println("Harga : "+harga); } }
Editor Settings
Theme
Key bindings
Full width
Lines