Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Hotel
- {
- class Hotel
- {
- static void Main(string[] args)
- {
- string month = Console.ReadLine().ToLower();
- int nightsCount = int.Parse(Console.ReadLine());
- double studioDiscount = 0.0;
- double doubleDiscount = 0.0;
- double suiteDiscount = 0.0;
- int studioPrice = 0;
- int doublePrice = 0;
- int suitePrice = 0;
- switch (month)
- {
- case "may": case "october":
- studioPrice = 50;
- doublePrice = 65;
- suitePrice = 75;
- if(nightsCount > 7)
- {
- studioDiscount = 0.05;
- }
- break;
- case "june": case "september":
- studioPrice = 60;
- doublePrice = 72;
- suitePrice = 82;
- if (nightsCount > 14)
- {
- doubleDiscount = 0.10;
- }
- break;
- case "july": case "august": case "december":
- studioPrice = 68;
- doublePrice = 77;
- suitePrice = 89;
- if (nightsCount > 14)
- {
- suiteDiscount = 0.15;
- }
- break;
- }
- var calcStudioPrice = (nightsCount * studioPrice) - ((nightsCount * studioPrice) * studioDiscount);
- var calcDoublePrice = (nightsCount * doublePrice) - ((nightsCount * doublePrice) * doubleDiscount);
- var calcSuitePrice = (nightsCount * suitePrice) - ((nightsCount * suitePrice) * suiteDiscount);
- if (month == "september" || month == "october")
- {
- if (nightsCount > 7)
- calcStudioPrice -= (calcStudioPrice / nightsCount);
- }
- string output = $"Studio: {calcStudioPrice:f2} lv. " +
- $"{Environment.NewLine}Double: {calcDoublePrice:f2} lv. " +
- $"{Environment.NewLine}Suite: {calcSuitePrice:f2} lv.";
- Console.WriteLine(output);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement