BubaLazi

06.TheatherDiscount

Jun 5th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.67 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 SomeHomeworks
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var day = Console.ReadLine().ToLower();
  14.             var age = int.Parse(Console.ReadLine());
  15.             var price = 0;
  16.  
  17.             if (day == "weekday")
  18.             {
  19.                 if ((age >= 0 && age <= 18) || (age > 64 && age <= 122))
  20.                 {
  21.                     price = 12;
  22.                 }
  23.                 else if(age > 18 && age <= 64 )
  24.                 {
  25.                     price = 18;
  26.                 }
  27.             }
  28.             else if (day == "weekend")
  29.             {
  30.                 if ((age >= 0 && age <= 18) || (age > 64 && age <= 122))
  31.                 {
  32.                     price = 15;
  33.                 }
  34.                 else if (age > 18 && age <= 64)
  35.                 {
  36.                     price = 20;
  37.                 }
  38.             }
  39.             else if (day == "holiday")
  40.             {
  41.                 if (age >= 0 && age <= 18)
  42.                 {
  43.                     price = 5;
  44.                 }
  45.                 else if (age > 18 && age <= 64)
  46.                 {
  47.                     price = 12;
  48.                 }
  49.                 else if(age > 64 && age <= 122)
  50.                 {
  51.                     price = 10;
  52.                 }              
  53.  
  54.             }
  55.  
  56.  
  57.             if (price != 0)
  58.             {
  59.                 Console.WriteLine(price + "$");
  60.             }
  61.             else
  62.             {
  63.                 Console.WriteLine("Error!");
  64.             }
  65.  
  66.  
  67.  
  68.  
  69.  
  70.         }
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment