Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Cinema Tickets
- {
- class Program
- {
- static void Main(string[] args)
- {
- string movie = "";
- string tickets = "";
- int counterStandard = 0;
- int counterKid = 0;
- int counterStudent = 0;
- int counterStandardALL = 0;
- int counterKidALL = 0;
- int counterStudentALL = 0;
- double howMany = 0;
- double howManyTickets = 0;
- double howManyTicketsALL = 0;
- while (true)
- {
- howManyTickets = 0;
- counterStandard = 0;
- counterKid = 0;
- counterStudent = 0;
- movie = Console.ReadLine();
- if (movie == "Finish")
- {
- break;
- }
- howMany = int.Parse(Console.ReadLine());
- while (true)
- {
- tickets = Console.ReadLine();
- if (tickets == "End" || tickets == "Finish")
- {
- break;
- }
- switch (tickets)
- {
- case "standard":
- counterStandard++;
- break;
- case "kid":
- counterKid++;
- break;
- case "student":
- counterStudent++;
- break;
- }
- }
- counterStandardALL += counterStandard;
- counterKidALL += counterKid;
- counterStudentALL += counterStudent;
- howManyTickets = counterStandard + counterKid + counterStudent;
- Console.WriteLine($"{movie} - {howManyTickets / howMany * 100:F2}% full.");
- if (tickets == "Finish")
- {
- break;
- }
- }
- howManyTicketsALL = counterStandardALL + counterStudentALL + counterKidALL;
- Console.WriteLine($"Total tickets: {howManyTicketsALL}");
- Console.WriteLine($"{counterStudentALL / howManyTicketsALL * 100:F2}% student tickets.");
- Console.WriteLine($"{counterStandardALL / howManyTicketsALL * 100:F2}% standard tickets.");
- Console.WriteLine($"{counterKidALL / howManyTicketsALL * 100:F2}% kids tickets.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement