VelizarAvramov

07. Theatre Promotion

Dec 16th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.53 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _07._Theatre_Promotion
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string day = Console.ReadLine();
  10.             int age = int.Parse(Console.ReadLine());
  11.  
  12.             int price = 0;
  13.  
  14.             if (age < 0 || age > 122)
  15.             {
  16.                 Console.WriteLine("Error!");
  17.                 return;
  18.             }
  19.  
  20.             if (day == "Weekday")
  21.             {
  22.                 if ((0 <= age && age <= 18) || (64 < age && age <= 122))
  23.                 {
  24.                     price += 12;
  25.                 }
  26.                 else if (18 < age && age <= 64)
  27.                 {
  28.                     price += 18;
  29.                 }
  30.             }
  31.             else if (day == "Weekend")
  32.             {
  33.                 if ((0 <= age && age <= 18) || (64 < age && age <= 122))
  34.                 {
  35.                     price += 15;
  36.                 }
  37.                 else if (18 < age && age <= 64)
  38.                 {
  39.                     price += 20;
  40.                 }
  41.             }
  42.             else if (day == "Holiday")
  43.             {
  44.                 if (0 <= age && age <= 18)
  45.                 {
  46.                     price += 5;
  47.                 }
  48.                 else if (18 < age & age <= 64)
  49.                 {
  50.                     price += 12;
  51.                 }
  52.                 else if (64 < age && age <= 122)
  53.                 {
  54.                     price += 10;
  55.                 }
  56.             }
  57.             Console.WriteLine($"{price}$");
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment