simeon3000

Hotel

May 30th, 2017
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.71 KB | None | 0 0
  1.             string month = Console.ReadLine();
  2.             int nights = int.Parse(Console.ReadLine());
  3.  
  4.             double studioPrice = 0.0;
  5.             double doublePrice = 0.0;
  6.             double suitePrice = 0.0;
  7.  
  8.             switch (month)
  9.             {
  10.                 case "May":
  11.                 case "October":
  12.                     studioPrice = 50 * nights;
  13.                     doublePrice = 65 * nights;
  14.                     suitePrice = 75 * nights;
  15.                     break;
  16.                 case "June":
  17.                 case "September":
  18.                     studioPrice = 60 * nights;
  19.                     doublePrice = 72 * nights;
  20.                     suitePrice = 82 * nights;
  21.                     break;
  22.                 case "July":
  23.                 case "August":
  24.                 case "December":
  25.                     studioPrice = 68 * nights;
  26.                     doublePrice = 77 * nights;
  27.                     suitePrice = 89 * nights;
  28.                     break;
  29.             }
  30.  
  31.             if (nights > 7 && month == "September")
  32.                 studioPrice -= 60;
  33.             if (nights > 7 && month == "October")
  34.                 studioPrice -= 50;
  35.  
  36.             if (nights > 7 && (month == "May" || month == "October"))
  37.                 studioPrice *= 0.95;
  38.             if (nights > 14 && (month == "June" || month == "September"))
  39.                 doublePrice *= 0.90;
  40.             if (nights > 14 && (month == "July" || month == "August" || month == "December"))
  41.                 suitePrice *= 0.85;
  42.            
  43.  
  44.             Console.WriteLine($"Studio: {studioPrice:f2} lv.");
  45.             Console.WriteLine($"Double: {doublePrice:f2} lv.");
  46.             Console.WriteLine($"Suite: {suitePrice:f2} lv.");
Advertisement
Add Comment
Please, Sign In to add comment