dakata450

Untitled

Jul 11th, 2022
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class cinema {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String input = scanner.nextLine();
  8.  
  9. int places = Integer.parseInt(scanner.nextLine());
  10. int count = 0;
  11. int countStandart = 0;
  12. int countstudent = 0;
  13. int countKid = 0;
  14.  
  15.  
  16. while (!input.equals("Finish")){
  17. String moviename = input;
  18. int thickets = Integer.parseInt(scanner.nextLine());
  19. int availableTickets = thickets;
  20.  
  21. input = scanner.nextLine();
  22. while (!input.equals("End")){
  23. count++;
  24.  
  25. if (input.equals("student")){
  26. countstudent++;
  27. }else if(input.equals("standard")){
  28. countStandart++;
  29. }else if (input.equals("kid")){
  30. countKid++;
  31. availableTickets--;
  32. }
  33. if(availableTickets == 0){
  34. break;
  35. }
  36. input = scanner.nextLine();
  37. }
  38. double boughTickets = thickets - availableTickets;
  39. double percentThickets = boughTickets / thickets * 100;
  40. System.out.printf("%s - %.2f%% full.", moviename, percentThickets );
  41. input = scanner.nextLine();
  42.  
  43.  
  44. }
  45.  
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment