Advertisement
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 Sinema_Tickets
- {
- class Program
- {
- static void Main(string[] args)
- {
- string name = Console.ReadLine();
- double capacity = 0;
- double totalcounter = 0;
- double totalStudent = 0;
- double totalStandard = 0;
- double totalKid = 0;
- int totalTicket = 0;
- while (name != "Finish")
- {
- string numberFreePlaces = Console.ReadLine();
- string type = Console.ReadLine();
- int counterStudent = 0;
- int counterStandard = 0;
- int counterKids = 0;
- switch (type)
- {
- case "student":
- counterStudent += 1;
- break;
- case "standard":
- counterStandard += 1;
- break;
- case "kid":
- counterKids += 1;
- break;
- default:
- break;
- }
- totalcounter = counterStudent + counterStandard + counterKids;
- while (totalcounter < int.Parse(numberFreePlaces))
- {
- type = Console.ReadLine();
- if (type == "End")
- {
- break;
- }
- else
- {
- switch (type)
- {
- case "student":
- counterStudent += 1;
- break;
- case "standard":
- counterStandard += 1;
- break;
- case "kid":
- counterKids += 1;
- break;
- default:
- break;
- }
- totalcounter += 1;
- }
- }
- capacity = (totalcounter * 100) / int.Parse(numberFreePlaces);
- Console.WriteLine($"{name} - {capacity:f2}% full.");
- totalKid += counterKids;
- totalStandard += counterStandard;
- totalStudent += counterStudent;
- totalTicket += (int)totalcounter;
- name = Console.ReadLine();
- }
- Console.WriteLine($"Total tickets: {totalTicket}");
- Console.WriteLine($"{((totalStudent*100)/ totalTicket):f2}% student tickets.");
- Console.WriteLine($"{((totalStandard * 100) / totalTicket):f2}% standard tickets.");
- Console.WriteLine($"{((totalKid * 100) / totalTicket):f2}% kids tickets.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement