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)
- {
- double studentTicket = 0;
- double standardTicket = 0;
- double kidTicket = 0;
- string movie = Console.ReadLine();
- while (movie != "Finish")
- {
- double counter = 0;
- int ticketNum = int.Parse(Console.ReadLine());
- for (int i = 0; i < ticketNum; i++)
- {
- string category = Console.ReadLine();
- if (category == "End" || category == "Finish")
- {
- break;
- }
- if (category == "student")
- {
- studentTicket++;
- }
- else if (category == "standard")
- {
- standardTicket++;
- }
- else
- {
- kidTicket++;
- }
- counter++;
- }
- Console.WriteLine($"{movie} - {counter / ticketNum * 100:f2}% full.");
- movie = Console.ReadLine();
- }
- double totalTickets = standardTicket + studentTicket + kidTicket;
- Console.WriteLine($"Total tickets: {totalTickets}");
- Console.WriteLine($"{studentTicket / totalTickets * 100:f2}% student tickets.");
- Console.WriteLine($"{standardTicket / totalTickets * 100:f2}% standard tickets.");
- Console.WriteLine($"{kidTicket / totalTickets * 100:f2}% kids tickets.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement