VelizarAvramov

04. Hotel

Nov 9th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.90 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04._Hotel
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string month = Console.ReadLine();
  10.             int nightsCount = int.Parse(Console.ReadLine());
  11.  
  12.             double priceStudio = 0;
  13.             double priceDouble = 0;
  14.             double priceSuite = 0;
  15.  
  16.             switch (month)
  17.             {
  18.                 case "May":
  19.                 case "October":
  20.                     priceStudio = 50;
  21.                     priceDouble = 65;
  22.                     priceSuite = 75;
  23.                     if (nightsCount > 7)
  24.                     {
  25.                         priceStudio *= 0.95;
  26.                     }
  27.                     break;
  28.                 case "June":
  29.                 case "September":
  30.                     priceStudio = 60;
  31.                     priceDouble = 72;
  32.                     priceSuite = 82;
  33.                     if (nightsCount > 14)
  34.                     {
  35.                         priceDouble *= 0.90;
  36.                     }
  37.                     break;
  38.                 case "July":
  39.                 case "August":
  40.                 case "December":
  41.                     priceStudio = 68;
  42.                     priceDouble = 77;
  43.                     priceSuite = 89;
  44.                     if (nightsCount > 14)
  45.                     {
  46.                         priceSuite *= 0.85;
  47.                     }
  48.                     break;
  49.  
  50.                 default:
  51.                     break;
  52.             }
  53.  
  54.             if ((nightsCount > 7) && (month == "September" || month == "October"))
  55.             {
  56.                 priceStudio *= (1 - (1.0 / nightsCount));
  57.             }
  58.             Console.WriteLine($"Studio: {priceStudio * nightsCount:f2} lv.");
  59.             Console.WriteLine($"Double: {priceDouble * nightsCount:f2} lv.");
  60.             Console.WriteLine($"Suite: {priceSuite * nightsCount:f2} lv.");
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment