Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class TheatrePromotions
- {
- public static void Main()
- {
- string dayType = Console.ReadLine();
- int age = int.Parse(Console.ReadLine());
- int price = 0;
- bool youth = age >= 0 && age <= 18;
- bool regular = age > 18 && age <= 64;
- bool senior = age > 64 && age <= 122;
- if (youth || senior)
- {
- switch (dayType)
- {
- case "Weekday": price = 12; break;
- case "Weekend": price = 15; break;
- case "Holiday": price = youth ? 5 : 10; break;
- }
- }
- else if (regular)
- {
- switch (dayType)
- {
- case "Weekday": price = 18; break;
- case "Weekend": price = 20; break;
- case "Holiday": price = 12; break;
- }
- }
- string output = price > 0 ? $"{price}$" : "Error!";
- Console.WriteLine(output);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement