Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _02b_ConditionalStatementsAndLoops_Exercises
- {
- class ConditionalStatementsAndLoopsEx
- {
- static void Main(string[] args)
- {
- string month = Console.ReadLine();
- int nightsCount = int.Parse(Console.ReadLine());
- double priceStudio = 0;
- double priceDouble = 0;
- double priceSuite = 0;
- switch (month)
- {
- case "May":
- case "October":
- priceStudio = 50;
- priceDouble = 65;
- priceSuite = 75;
- break;
- case "June":
- case "September":
- priceStudio = 60;
- priceDouble = 72;
- priceSuite = 82;
- break;
- case "July":
- case "August":
- case "December":
- priceStudio = 68;
- priceDouble = 77;
- priceSuite = 89;
- break;
- }
- if ((month == "May" || month == "October") && nightsCount > 7)
- {
- priceStudio = priceStudio * 95 / 100;
- }
- if ((month == "June" || month == "September") && nightsCount > 14)
- {
- priceDouble = priceDouble * 90 / 100;
- }
- if ((month == "July" || month == "August" || month == "December") && nightsCount > 14)
- {
- priceSuite = priceSuite * 85 / 100;
- }
- double totalPriceStudio = priceStudio * nightsCount;
- double totalPriceDouble = priceDouble * nightsCount;
- double totalPriceSuite = priceSuite * nightsCount;
- if ((month == "September" || month == "October") && nightsCount > 7)
- {
- totalPriceStudio -= priceStudio;
- }
- Console.WriteLine($"Studio: {totalPriceStudio:F2} lv.");
- Console.WriteLine($"Double: {totalPriceDouble:F2} lv.");
- Console.WriteLine($"Suite: {totalPriceSuite:F2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment