Advertisement
Pazzobg

Programming Basics Exams/28AUG16/03. HotelRoom

Mar 11th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.76 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _05.HotelRoom
  4. {
  5.     class HotelRoom
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string month = Console.ReadLine().ToLower();
  10.             int nights = int.Parse(Console.ReadLine());
  11.             double priceStudio = 0.0;
  12.             double priceAppartment = 0.0;
  13.             double endPriceStudio = 0.0;
  14.             double endPriceApp = 0.0;
  15.  
  16.             if (month == "may" || month == "october")
  17.             {
  18.                 priceStudio += 50;
  19.                 priceAppartment += 65;
  20.             }
  21.             else if (month == "june" || month == "september")
  22.             {
  23.                 priceStudio += 75.20;
  24.                 priceAppartment += 68.70;
  25.             }
  26.             else if (month == "july" || month == "august")
  27.             {
  28.                 priceStudio += 76;
  29.                 priceAppartment += 77;
  30.             }
  31.             endPriceStudio = nights * priceStudio;
  32.             endPriceApp = nights * priceAppartment;
  33.  
  34.             if (nights > 14 && (month == "may" || month == "october"))
  35.             {
  36.                 endPriceStudio -= (endPriceStudio * 0.3);
  37.             }
  38.             else if ((nights > 7 && nights <= 14) && (month == "may" || month == "october"))
  39.             {
  40.                 endPriceStudio -= (endPriceStudio * 0.05);
  41.             }
  42.             if (nights > 14 && (month == "june" || month == "september"))
  43.             {
  44.                 endPriceStudio -= (endPriceStudio * 0.2);
  45.             }
  46.             if (nights > 14)
  47.             {
  48.                 endPriceApp -= (endPriceApp * 0.10);
  49.             }
  50.             Console.WriteLine("Apartment: {0:f2} lv.", endPriceApp);
  51.             Console.WriteLine("Studio: {0:f2} lv.", endPriceStudio);
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement