Advertisement
Ivelin_1936

Hotel

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