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 ConsoleApp32
- {
- class Program
- {
- static void Main(string[] args)
- {
- string movieOrFinish = Console.ReadLine();
- double availableSeats = double.Parse(Console.ReadLine());
- string typeSeats = "";
- double student = 0;
- double standard = 0;
- double kid = 0;
- double totalseatsCounter = 1;
- bool check = true;
- double studentPercent = 0;
- double standardPercent = 0;
- double kidPercent = 0;
- while (movieOrFinish != "Finish")
- {
- for (int counter = 1; counter <= availableSeats; counter++)
- {
- typeSeats = Console.ReadLine();
- if (typeSeats == "student")
- {
- student++;
- studentPercent++;
- }
- else if (typeSeats == "standard")
- {
- standard++;
- standardPercent++;
- }
- else if (typeSeats == "kid")
- {
- kid++;
- kidPercent++;
- }
- if (typeSeats == "End" || counter == availableSeats)
- {
- double percent = (student + standard + kid) / availableSeats * 100;
- Console.WriteLine($"{movieOrFinish} - {percent:f2}% full. ");
- student = 0;
- standard = 0;
- kid = 0;
- counter = 0;
- break;
- }
- totalseatsCounter++;
- }
- movieOrFinish = Console.ReadLine();
- if (movieOrFinish == "Finish")
- {
- Console.WriteLine($"Total tickets: {totalseatsCounter}");
- Console.WriteLine($"{(studentPercent / totalseatsCounter * 100):F2}% student tickets.");
- Console.WriteLine($"{(standardPercent / totalseatsCounter * 100):F2}% standard tickets.");
- Console.WriteLine($"{(kidPercent / totalseatsCounter * 100):F2}% kids tickets.");
- }
- availableSeats = double.Parse(Console.ReadLine());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement