Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Hotel
- {
- class Hotel
- {
- static void Main(string[] args)
- {
- string month = Console.ReadLine();
- int nightCount = int.Parse(Console.ReadLine());
- double priceStudio = 0.0, priceDoubleRoom = 0.0, priceSuite = 0.0;
- double discountStudioMayOctober = 0.0, discountDouble = 0.0,
- discountSuite = 0.0;
- double priceTotalStudio = 0, priceTotalDoubleRoom = 0, priceTotalSuite = 0;
- switch (month)
- {
- case "May":
- case "October":
- priceStudio = 50.0;
- priceDoubleRoom = 65.0;
- priceSuite = 75.0;
- if (nightCount > 7)
- {
- discountStudioMayOctober = 0.05;
- }
- break;
- case "June":
- case "September":
- priceStudio = 60.0;
- priceDoubleRoom = 72.0;
- priceSuite = 82.0;
- if (nightCount > 14)
- {
- discountDouble = 0.10;
- }
- break;
- case "July":
- case "August":
- case "December":
- priceStudio = 68.0;
- priceDoubleRoom = 77.0;
- priceSuite = 89.0;
- if (nightCount > 14)
- {
- discountSuite = 0.15;
- }
- break;
- }
- priceTotalStudio = priceStudio * nightCount * (1 - discountStudioMayOctober);
- if ((month == "September" || month == "October") && (nightCount > 7)) //one night free
- {
- priceTotalStudio = priceTotalStudio - 1 * priceStudio;
- }
- priceTotalDoubleRoom = priceDoubleRoom * nightCount * (1 - discountDouble);
- priceTotalSuite = priceSuite * nightCount * (1 - discountSuite);
- Console.WriteLine($"Studio: {priceTotalStudio:f2} lv.");
- Console.WriteLine($"Double: {priceTotalDoubleRoom:F2} lv.");
- Console.WriteLine($"Suite: {priceTotalSuite:F2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment