Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
749 B
3
Indexable
Never
import java.util.Scanner;

class Test {

    public static void main(String[] args) {
        Scanner masuk = new Scanner(System.in);
        String pemilik;
        int jam;
        int harga = 3000;
        System.out.print("Masukkan status: ");
        pemilik = masuk.next();
        switch (pemilik) {
            case "Y":
                System.out.println("Biaya parkir : Rp. " + 0);
                break;
            case "T":
                System.out.print("Masukkan jam :");
                jam = masuk.nextInt();
                System.out.println("Biaya parkir : Rp. " + (jam * harga));
                break;
            default:
                System.out.println("Pilihan tidak tersedia");
                break;
        }
    }
}
Leave a Comment