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_Tickets
- {
- class Program
- {
- static void Main(string[] args)
- {
- int students = 0;
- int standarts = 0;
- int kids = 0;
- string name = Console.ReadLine();
- while(name != "Finish")
- {
- int n = int.Parse(Console.ReadLine());
- int count = 0;
- for (int i = 0; i < n; i++)
- {
- string type = Console.ReadLine();
- if (type == "End")
- break;
- switch(type)
- {
- case "student":
- students++;
- break;
- case "standard":
- standarts++;
- break;
- case "kid":
- kids++;
- break;
- }
- count++;
- }
- Console.WriteLine("{0} - {1:f2}% full.", name, count * 100 / n);
- name = Console.ReadLine();
- }
- int all = students + standarts + kids;
- Console.WriteLine("Total tickets: " + all);
- Console.WriteLine("{0:f2} student tickets", 100 * students / all);
- Console.WriteLine("{0:f2}% standard tickets", standarts * 100 / all);
- Console.WriteLine("{0:f2}% kids tickets", kids * 100 / all);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment