Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CinemaTickets
- {
- public class Program
- {
- public static void Main(string[] args)
- {
- string movie = Console.ReadLine();
- int student = 0;
- int standard = 0;
- int kids = 0;
- while (movie != "Finish")
- {
- int totalCount = 0;
- int seats = int.Parse(Console.ReadLine());
- string ticketType = string.Empty;
- while (ticketType != "End" && seats > totalCount)
- {
- ticketType = Console.ReadLine();
- switch(ticketType)
- {
- case "student":
- student++;
- totalCount++;
- break;
- case "standard":
- standard++;
- totalCount++;
- break;
- case "kid":
- kids++;
- totalCount++;
- break;
- }
- }
- double percent = totalCount * 1.00 / seats * 100;
- Console.WriteLine($"{movie} - {percent:f2}% full.");
- movie = Console.ReadLine();
- }
- int totalTickets = student + standard + kids;
- double studentPercent = student * 1.00 / totalTickets * 100;
- double standardPercent = standard * 1.00 / totalTickets * 100;
- double kidsPercent = kids * 1.00 / totalTickets * 100;
- Console.WriteLine($"Total tickets: {totalTickets}");
- Console.WriteLine($"{studentPercent:f2}% student tickets.");
- Console.WriteLine($"{standardPercent:f2}% standard tickets.");
- Console.WriteLine($"{kidsPercent:f2}% kids tickets.");
- }
- }
- }
Add Comment
Please, Sign In to add comment