Едно решение на 07. Cinema Tickets на C#
using System;
namespace CinemaTickets
{
class CinemaTickets
{
static void Main(string[] args)
{
string command = Console.ReadLine();
double countStandardTickets = 0;
double countStudentTickets = 0;
double countKidTickets = 0;
while (command!="Finish")
{
int seats = int.Parse(Console.ReadLine());
double soldTickets = 0;
for (int i = 1; i <= seats; i++)
{
string seatType = Console.ReadLine();
if (seatType == "End")
{
break;
}
else if (seatType == "student")
{
countStudentTickets++;
}
else if (seatType == "standard")
{
countStandardTickets++;
}
else if (seatType == "kid")
{
countKidTickets++;
}
soldTickets++;
}
Console.WriteLine($"{command} - {(soldTickets/ seats)*100:f2}% full.");
command = Console.ReadLine();
}
double countTotalTickets = countStandardTickets + countStudentTickets + countKidTickets;
Console.WriteLine($"Total tickets: {countTotalTickets}");
Console.WriteLine($"{countStudentTickets / (countStandardTickets + countStudentTickets + countKidTickets)* 100:f2}% student tickets.");
Console.WriteLine($"{countStandardTickets / (countStandardTickets + countStudentTickets + countKidTickets) * 100:f2}% standard tickets.");
Console.WriteLine($"{countKidTickets / (countStandardTickets + countStudentTickets + countKidTickets) * 100:f2}% kids tickets.");
}
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}