Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _07.CinemaTickets
- {
- class CinemaTickets
- {
- static void Main(string[] args)
- {
- string filmname = Console.ReadLine();
- double totalKids = 0;
- double totalStudents = 0;
- double totalStandard = 0;
- double totalTickets = 0;
- while (filmname != "Finish")
- {
- int kids = 0;
- int students = 0;
- int standard = 0;
- double freeSeats = int.Parse(Console.ReadLine());
- for (int currentSeat = 1; currentSeat <= freeSeats; currentSeat++)
- {
- string ticketType = Console.ReadLine();
- if (ticketType == "kid")
- {
- kids++;
- }
- else if (ticketType == "student")
- {
- students++;
- }
- else if (ticketType == "standard")
- {
- standard++;
- }
- else if (ticketType == "End")
- {
- break;
- }
- }
- totalKids += kids;
- totalStudents += students;
- totalStandard += standard;
- double percentFull = ((students + standard + kids) / freeSeats * 100);
- Console.WriteLine($"{filmname} - {percentFull:f2}% full.");
- filmname = Console.ReadLine();
- }
- totalTickets = totalStandard + totalStudents + totalKids;
- Console.WriteLine($"Total tickets: {totalTickets}");
- Console.WriteLine($"{((totalStudents / totalTickets) * 100):f2}% student tickets.");
- Console.WriteLine($"{((totalStandard / totalTickets) * 100):f2}% standard tickets.");
- Console.WriteLine($"{((totalKids / totalTickets) * 100):f2}% kids tickets.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement