Advertisement
Guest User

Hotel Fixed

a guest
Apr 27th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.42 KB | None | 0 0
  1. using System;
  2.  
  3. namespace FixProblem
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string month = Console.ReadLine();
  10.             decimal nights = decimal.Parse(Console.ReadLine());
  11.             decimal pricePerNightStudio = 0m;
  12.             decimal pricePerNightDouble = 0m;
  13.             decimal pricePerNightSuite = 0m;
  14.  
  15.             switch (month)
  16.             {
  17.                 case "May":
  18.                 case "October":
  19.                     pricePerNightStudio = 50m;
  20.                     pricePerNightDouble = 65m;
  21.                     pricePerNightSuite = 75m;
  22.                     break;
  23.                 case "June":
  24.                 case "September":
  25.                     pricePerNightStudio = 60m;
  26.                     pricePerNightDouble = 72m;
  27.                     pricePerNightSuite = 82m;
  28.                     break;
  29.                 case "July":
  30.                 case "August":
  31.                 case "December":
  32.                     pricePerNightStudio = 68m;
  33.                     pricePerNightDouble = 77m;
  34.                     pricePerNightSuite = 89m;
  35.                     break;
  36.             }
  37.  
  38.             decimal studioStay = pricePerNightStudio * nights;
  39.             decimal doubleStay = pricePerNightDouble * nights;
  40.             decimal suiteStay = pricePerNightSuite * nights;
  41.  
  42.             if (nights > 7 && (month == "May" || month == "October"))
  43.             {
  44.                 studioStay = studioStay - (studioStay * 0.05m);
  45.                 if (month == "October")
  46.                 {
  47.                     pricePerNightStudio = 50m * 0.95m;
  48.                     studioStay = pricePerNightStudio * (nights - 1);
  49.                 }
  50.             }
  51.  
  52.             else if (nights > 14 && (month == "June" || month == "September"))
  53.             {
  54.                 doubleStay = doubleStay - (doubleStay * 0.1m);
  55.             }
  56.  
  57.             else if (nights > 14 && (month == "July" || month == "August" || month == "December"))
  58.             {
  59.                 suiteStay = suiteStay - (suiteStay * 0.15m);
  60.             }
  61.  
  62.             else if (nights > 7 && (month == "September"))
  63.             {
  64.                 studioStay = studioStay - pricePerNightStudio;
  65.             }
  66.  
  67.             Console.WriteLine($"Studio: {studioStay:f2} lv.");
  68.             Console.WriteLine($"Double: {doubleStay:f2} lv.");
  69.             Console.WriteLine($"Suite: {suiteStay:f2} lv.");
  70.  
  71.         }
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement