Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace cinema_nested_loop_
- {
- class Program
- {
- static void Main(string[] args)
- {
- int standart = 0;
- int student = 0;
- int kid = 0;
- int movieTickets = 0;
- while (true)
- {
- string film = Console.ReadLine();
- if (film == "Finish")
- {
- break;
- }
- int capacity = int.Parse(Console.ReadLine());
- int totalTicket = 0;
- do
- {
- string ticketType = Console.ReadLine();
- if (ticketType == "End")
- {
- break;
- }
- else
- {
- switch (ticketType)
- {
- case "standard":
- standart++;
- break;
- case "kid":
- kid++;
- break;
- case "student":
- student++;
- break;
- }
- totalTicket++;
- }
- } while (capacity > totalTicket);
- Console.WriteLine($"{film}-{totalTicket * 100 / capacity}% full.");
- Console.WriteLine($"Total tickets:{movieTickets += totalTicket}");
- Console.WriteLine($"{student * 100 / capacity:f2}% student tickets.");
- Console.WriteLine($"{standart * 100 / capacity:f2}% standard tickets.");
- Console.WriteLine($"{kid * 100 / capacity:f2}% kid tickets.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment