Advertisement
silvana1303

travel agency

Apr 28th, 2020
781
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.31 KB | None | 0 0
  1. using System;
  2.  
  3. namespace exampreparation
  4.  
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             string city = Console.ReadLine();
  11.             string packet = Console.ReadLine();
  12.             string vip = Console.ReadLine();
  13.             int days = int.Parse(Console.ReadLine());
  14.  
  15.             if (days < 1)
  16.             {
  17.                 Console.WriteLine("Days must be positive number!");
  18.                 return;
  19.             }
  20.             if (days > 7)
  21.             {
  22.                 days--;
  23.             }
  24.  
  25.             double price = 0.0;
  26.  
  27.             if (city == "Bansko" || city == "Borovets")
  28.             {
  29.                 if (packet == "withEquipment")
  30.                 {
  31.                     price = 100.0;
  32.  
  33.                     if (vip == "yes")
  34.                     {
  35.                         price *= 0.90;
  36.                     }
  37.                    
  38.                 }
  39.                 else if(packet == "noEquipment")
  40.                 {
  41.                     price = 80.0;
  42.  
  43.                     if (vip == "yes")
  44.                     {
  45.                         price *= 0.95;
  46.                     }
  47.                 }
  48.                 else
  49.                 {
  50.                     Console.WriteLine("Invalid input!");
  51.                     return;
  52.                 }
  53.             }
  54.             else if (city == "Varna" || city == "Burgas")
  55.             {
  56.                 if (packet == "withBreakfast")
  57.                 {
  58.                     price = 130.0;
  59.  
  60.                     if (vip == "yes")
  61.                     {
  62.                         price *= 0.88;
  63.                     }
  64.                 }
  65.                 else if(packet == "noBreakfast")
  66.                 {
  67.                     price = 100.0;
  68.  
  69.                     if (vip == "yes")
  70.                     {
  71.                         price *= 0.93;
  72.                     }
  73.                 }
  74.                 else
  75.                 {
  76.                     Console.WriteLine("Invalid input!");
  77.                     return;
  78.                 }
  79.             }
  80.             else
  81.             {
  82.                 Console.WriteLine("Invalid input!");
  83.                 return;
  84.             }
  85.  
  86.             double fullSum = days * price;
  87.  
  88.             Console.WriteLine($"The price is {fullSum:f2}lv! Have a nice time!");
  89.         }
  90.     }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement