Advertisement
Pazzobg

Temp1

May 26th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. using System;
  2.  
  3. public class TheatrePromotions
  4. {
  5.     public static void Main()
  6.     {
  7.         string dayType = Console.ReadLine();
  8.         int age = int.Parse(Console.ReadLine());
  9.         int price = 0;
  10.         bool youth = age >= 0 && age <= 18;
  11.         bool regular = age > 18 && age <= 64;
  12.         bool senior = age > 64 && age <= 122;
  13.  
  14.         if (youth || senior)
  15.         {
  16.             switch (dayType)
  17.             {
  18.                 case "Weekday": price = 12; break;
  19.                 case "Weekend": price = 15; break;
  20.                 case "Holiday": price = youth ? 5 : 10; break;
  21.             }
  22.         }
  23.         else if (regular)
  24.         {
  25.             switch (dayType)
  26.             {
  27.                 case "Weekday": price = 18; break;
  28.                 case "Weekend": price = 20; break;
  29.                 case "Holiday": price = 12; break;
  30.             }
  31.         }
  32.  
  33.         string output = price > 0 ? $"{price}$" : "Error!";
  34.         Console.WriteLine(output);
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement