Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CinemaTickets
- {
- class Program
- {
- static void Main(string[] args)
- {
- string movieName = Console.ReadLine();
- int totalStudentTickets = 0;
- int totalStandardTickets = 0;
- int totalKidsTickets = 0;
- while (movieName != "Finish")
- {
- int ticketsOfCurrentMovieCount = 0;
- int freeSpacesOfCurrentMovie = int.Parse(Console.ReadLine());
- string typeOfCurrentTicket = string.Empty;
- while (typeOfCurrentTicket != "End" && ticketsOfCurrentMovieCount < freeSpacesOfCurrentMovie)
- {
- typeOfCurrentTicket = Console.ReadLine();
- switch (typeOfCurrentTicket)
- {
- case "student": totalStudentTickets++; ticketsOfCurrentMovieCount++; break;
- case "standard": totalStandardTickets++; ticketsOfCurrentMovieCount++; break;
- case "kid": totalKidsTickets++; ticketsOfCurrentMovieCount++; break;
- }
- }
- double pOccupancyOfTheHall = ticketsOfCurrentMovieCount * 1.0 / freeSpacesOfCurrentMovie * 100;
- Console.WriteLine($"{movieName} - {pOccupancyOfTheHall:f2}% full.");
- movieName = Console.ReadLine();
- }
- int totalTickets = totalStudentTickets + totalStandardTickets + totalKidsTickets;
- double pStudentTickets = totalStudentTickets * 1.0 / totalTickets * 100;
- double pStandardTickets = totalStandardTickets * 1.0 / totalTickets * 100;
- double pKidsTickets = totalKidsTickets * 1.0 / totalTickets * 100;
- Console.WriteLine($"Total tickets: {totalTickets}");
- Console.WriteLine($"{pStudentTickets:f2}% student tickets.");
- Console.WriteLine($"{pStandardTickets:f2}% standard tickets.");
- Console.WriteLine($"{pKidsTickets:f2}% kids tickets.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement