Advertisement
anizko

07. Theatre Promotion

May 18th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.89 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _7.Theatre_Promotions
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string KindDay = Console.ReadLine().ToLower();
  14.             int Age = int.Parse(Console.ReadLine());
  15.             double price = 0;
  16.  
  17.             switch(KindDay)
  18.             {
  19.                 case "weekday":
  20.                     if ((Age >= 0 && Age <= 18) || (Age > 64 && Age <= 122))
  21.                     {
  22.                         price = 12;
  23.                     }
  24.                     else if (Age > 18 && Age <= 64)
  25.                     {
  26.                         price = 18;
  27.                     }
  28.                    
  29.                         break;
  30.  
  31.                 case "weekend":
  32.                     if ((Age >= 0 && Age <= 18)|| (Age > 64 && Age <= 122))
  33.                     {
  34.                         price = 15;
  35.                     }
  36.                     else if (Age > 18 && Age <= 64)
  37.                     {
  38.                         price = 20;
  39.                     }
  40.                    
  41.                     break;
  42.  
  43.                 case "holiday":
  44.                     if (Age >= 0 && Age <= 18)
  45.                     {
  46.                         price = 5;
  47.                     }
  48.                     else if (Age > 18 && Age <= 64)
  49.                     {
  50.                         price = 12;
  51.                     }
  52.                     else if (Age > 64 && Age <= 122)
  53.                     {
  54.                         price = 10;
  55.                     }
  56.                    
  57.                     break;
  58.             }
  59.  
  60.             if (Age >= 0 && Age <= 122)
  61.             {
  62.                 Console.WriteLine($"{price}$");
  63.             }
  64.             else
  65.             {
  66.                 Console.WriteLine("Error!");
  67.             }
  68.  
  69.  
  70.         }
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement