Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. int guestPerformer = Integer.parseInt(sc.nextLine());
  2.         String input = sc.nextLine();
  3.         int income = 0;
  4.         int allIncome = 0;
  5.         int allGuest = 0;
  6.  
  7.         while (!input.equals("The restaurant is full")) {
  8.             int guest = Integer.parseInt(input);
  9.             if (guest < 5) {
  10.                 income = guest * 100;
  11.             } else {
  12.                 income = guest * 70;
  13.             }
  14.             allIncome += income;
  15.             allGuest += guest;
  16.             input = sc.nextLine();
  17.         }
  18.         if (guestPerformer <= allIncome) {
  19.             System.out.printf("You have %d guests and %d leva left.", allGuest, (allIncome - guestPerformer));
  20.         } else {
  21.             System.out.printf("You have %d guests and %d leva income, but no singer.", allGuest, allIncome);
  22.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement