Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class four {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int capaciti= Integer.parseInt(scanner.nextLine());
  8. int count= Integer.parseInt(scanner.nextLine());
  9. boolean done=false;
  10. int total=0;
  11. int moneyTotal=0;
  12.  
  13.  
  14. while (!done){
  15. total=count+total;
  16. if (count%3==0){
  17. moneyTotal=(count*5)-5+(moneyTotal);
  18. }else {
  19. moneyTotal=count*5+(moneyTotal);
  20. }
  21.  
  22.  
  23.  
  24. String full = scanner.nextLine();
  25. if (full.equals("Movie time!")){
  26. System.out.printf("There are %d seats left in the cinema.%n",capaciti-total);
  27. done=true;
  28. break;
  29.  
  30. }
  31. if (capaciti<=total) {
  32. System.out.printf("The cinema is full.%n");
  33. done = true;
  34. break;
  35. }
  36. count =Integer.parseInt(full);
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47. }
  48. System.out.printf("Cinema income - %d lv.",moneyTotal);
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement