Advertisement
madeofglass

Untitled

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