Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- boolean jumlahMakanan = (sc.nextInt() >= 10);
- boolean jumlahSusu = (sc.nextInt() >= 10);
- boolean jumlahKaleng = (sc.nextInt() % 5 == 0);
- boolean jumlahMieInstant = (sc.nextInt() % 5 == 0);
- int totalDisc = 0;
- if(jumlahMakanan && jumlahSusu) {
- totalDisc += 10;
- }
- else if(jumlahKaleng && jumlahMieInstant) {
- totalDisc += 5;
- }
- else {
- totalDisc += 3;
- }
- System.out.println("Total Discount: " + totalDisc);
- sc.close()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement