Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class cinema {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String input = scanner.nextLine();
- int places = Integer.parseInt(scanner.nextLine());
- int count = 0;
- int countStandart = 0;
- int countstudent = 0;
- int countKid = 0;
- while (!input.equals("Finish")){
- String moviename = input;
- int thickets = Integer.parseInt(scanner.nextLine());
- int availableTickets = thickets;
- input = scanner.nextLine();
- while (!input.equals("End")){
- count++;
- if (input.equals("student")){
- countstudent++;
- }else if(input.equals("standard")){
- countStandart++;
- }else if (input.equals("kid")){
- countKid++;
- availableTickets--;
- }
- if(availableTickets == 0){
- break;
- }
- input = scanner.nextLine();
- }
- double boughTickets = thickets - availableTickets;
- double percentThickets = boughTickets / thickets * 100;
- System.out.printf("%s - %.2f%% full.", moviename, percentThickets );
- input = scanner.nextLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment