Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int guestPerformer = Integer.parseInt(sc.nextLine());
- String input = sc.nextLine();
- int income = 0;
- int allIncome = 0;
- int allGuest = 0;
- while (!input.equals("The restaurant is full")) {
- int guest = Integer.parseInt(input);
- if (guest < 5) {
- income = guest * 100;
- } else {
- income = guest * 70;
- }
- allIncome += income;
- allGuest += guest;
- input = sc.nextLine();
- }
- if (guestPerformer <= allIncome) {
- System.out.printf("You have %d guests and %d leva left.", allGuest, (allIncome - guestPerformer));
- } else {
- System.out.printf("You have %d guests and %d leva income, but no singer.", allGuest, allIncome);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement