Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class HotelRoom
- {
- static void Main(string[] args)
- {
- string month = Console.ReadLine().ToLower();
- int nights = int.Parse(Console.ReadLine());
- double studioPrice = 50.00;
- double apartmentPrice = 65.00;
- double studioDiscount = 0.00;
- double apartmentDiscount = 0.00;
- switch (month)
- {
- case "may":
- case "october":
- if (nights > 14)
- {
- studioDiscount = 0.30;
- apartmentDiscount = 0.10;
- }
- else if (nights > 7)
- {
- studioDiscount = 0.05;
- }
- break;
- case "june":
- case "september":
- studioPrice = 75.20;
- apartmentPrice = 68.70;
- if (nights > 14)
- {
- studioDiscount = 0.20;
- apartmentDiscount = 0.10;
- }
- break;
- case "july":
- case "august":
- studioPrice = 76.00;
- apartmentPrice = 77.00;
- if (nights > 14)
- {
- apartmentDiscount = 0.10;
- }
- break;
- default:
- Console.WriteLine("Off season");
- break;
- }
- double moneyForStudio = nights * studioPrice;
- moneyForStudio = moneyForStudio - (moneyForStudio * studioDiscount);
- double moneyForApartment = nights * apartmentPrice;
- moneyForApartment = moneyForApartment - (moneyForApartment * apartmentDiscount);
- Console.WriteLine($"Apartment: {moneyForApartment:F} lv.");
- Console.WriteLine($"Studio: {moneyForStudio:F} lv.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement