Advertisement
AlexTasev

Untitled

Apr 3rd, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.94 KB | None | 0 0
  1. using System;
  2.  
  3. namespace HotelRoom
  4. {
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             string month = Console.ReadLine();
  10.             int nights = int.Parse(Console.ReadLine());
  11.  
  12.             double priceApartment = 0;
  13.             double priceStudio = 0;
  14.            
  15.             switch (month)
  16.             {
  17.                 case "May":
  18.                 case "October":
  19.                     priceApartment = 65.00;
  20.                     priceStudio = 50.00;
  21.                     if (nights > 7)
  22.                     {
  23.                         priceStudio = priceStudio - (priceStudio * 0.05);
  24.                     }
  25.                     else if (nights > 14)
  26.                     {
  27.                         priceStudio = priceStudio - (priceStudio * 0.3);
  28.                         priceApartment = priceApartment - (priceApartment * 0.1);
  29.                     }
  30.                     break;
  31.                 case "June":
  32.                 case "September ":
  33.                     priceApartment = 68.70;
  34.                     priceStudio = 65.20;
  35.                     if (nights > 14)
  36.                     {
  37.                         priceStudio = priceStudio - (priceStudio * 0.2);
  38.                         priceApartment = priceApartment - (priceApartment * 0.1);
  39.                     }
  40.                     break;
  41.                 case "July":
  42.                 case "August":
  43.                     priceApartment = 77.00;
  44.                     priceStudio = 76.00;
  45.                     if (nights > 14)
  46.                     {
  47.                         priceApartment = priceApartment - (priceApartment * 0.1);
  48.                     }
  49.                     break;
  50.             }
  51.  
  52.             double stayInApartment = nights * priceApartment;
  53.             double stayInStudio = nights * priceStudio;
  54.  
  55.             Console.WriteLine($"Apartment: {stayInApartment:f2} lv.");
  56.             Console.WriteLine($"Studio: {stayInStudio:f2} lv.");
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement