Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class four {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int capaciti= Integer.parseInt(scanner.nextLine());
- int count= Integer.parseInt(scanner.nextLine());
- boolean done=false;
- int total=0;
- int moneyTotal=0;
- while (!done){
- total=count+total;
- if (count%3==0){
- moneyTotal=(count*5)-5+(moneyTotal);
- }else {
- moneyTotal=count*5+(moneyTotal);
- }
- String full = scanner.nextLine();
- if (full.equals("Movie time!")){
- System.out.printf("There are %d seats left in the cinema.%n",capaciti-total);
- done=true;
- break;
- }
- if (capaciti<=total) {
- System.out.printf("The cinema is full.%n");
- done = true;
- break;
- }
- count =Integer.parseInt(full);
- }
- System.out.printf("Cinema income - %d lv.",moneyTotal);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement