Advertisement
DevilLord

Untitled

Feb 27th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1.  
  2.     public static void main(String[] args) {
  3.         Scanner sc = new Scanner(System.in);
  4.         boolean jumlahMakanan = (sc.nextInt() >= 10);
  5.         boolean jumlahSusu = (sc.nextInt() >= 10);
  6.         boolean jumlahKaleng = (sc.nextInt() % 5 == 0);
  7.         boolean jumlahMieInstant = (sc.nextInt() % 5 == 0);
  8.         int totalDisc = 0;
  9.         if(jumlahMakanan && jumlahSusu) {
  10.             totalDisc += 10;
  11.         }
  12.         else if(jumlahKaleng && jumlahMieInstant) {
  13.             totalDisc += 5;
  14.         }
  15.         else {
  16.             totalDisc += 3;
  17.         }
  18.  
  19.         System.out.println("Total Discount: " + totalDisc);
  20.  
  21.         sc.close()
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement