Minggu, 22 September 2019

LATIHAN SOAL PBO

LATIHAN SOAL PBO


public class TUGASPBO {
    public static void main(String[] args) {
            char pilihan = '3';
            int harga = 60000;
            
        switch(pilihan) {
        case '1' :
        System.out.println("Program IF");
          
        if (harga <= 61000) {
        System.out.println("Harga setelah diskon");
        }
        break;
               
        case '2' :
        System.out.println("Program IFELSE");
               
        if(harga>=61000) {       
        System.out.println("Selamat Anda Mendapatkan Hadiah");
        }
        else {      
        System.out.println("Maaf Anda Belum Beruntung");
        }
        break;
                
        case '3' :
        System.out.println("Program IFELSEIF");
       
        if(harga>=61000) {       
        System.out.println("Kamu Mendapat Potongan Harga Rp.30.000");
        }
        else if(harga>=61000) {       
        System.out.println("Kamu Mendapat Potongan Harga Rp.40.000");
        }
        else {       
        System.out.println("Maaf, Anda Belum Beruntung");
                }
        break;
           
        case '4' :
        System.out.println("Program NESTEDIF");
       
        if (harga > 0 ) {
            if (harga < 60000) {
                System.out.println("Selamat, Anda Mendapatkan kupon belanja");
            }
        }

        break;
               
        default :
        System.out.println("Inputan Salah");
        }
    }
}

Tidak ada komentar:

Posting Komentar