Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp8
- {
- class Program
- {
- static void Main(string[] args)
- {
- const double mayAndOctoberStudioPrice = 50;
- const double mayAndOctoberApartmentPrice = 65;
- const double juneAndSeptemberStudioPrice = 75.20;
- const double juneAndSeptemberApartmentPrice = 68.70;
- const double julyAndAugustStudioPrice = 76;
- const double julyAndAugustApartmentPrice = 77;
- double totalMoneyForApartment = 0;
- double totalMoneyForStudio = 0;
- string season = Console.ReadLine();
- int nights = int.Parse(Console.ReadLine());
- switch (season)
- {
- case "May":
- case "October":
- totalMoneyForApartment = nights * mayAndOctoberApartmentPrice;
- totalMoneyForStudio = nights * mayAndOctoberStudioPrice;
- if (nights > 7 && nights < 14)
- {
- totalMoneyForStudio = totalMoneyForStudio - (totalMoneyForStudio * 0.05);
- }
- else if (nights > 14)
- {
- totalMoneyForStudio = totalMoneyForStudio - (totalMoneyForStudio * 0.30);
- }
- break;
- case "June":
- case "September":
- totalMoneyForStudio = nights * juneAndSeptemberStudioPrice;
- totalMoneyForApartment = nights * juneAndSeptemberApartmentPrice;
- if (nights > 14)
- {
- totalMoneyForStudio = totalMoneyForStudio - (totalMoneyForStudio * 0.20);
- }
- break;
- case "July":
- case "August":
- totalMoneyForStudio = nights * julyAndAugustStudioPrice;
- totalMoneyForApartment = nights * julyAndAugustApartmentPrice;
- break;
- }
- if (nights > 14)
- {
- totalMoneyForApartment = totalMoneyForApartment - (totalMoneyForApartment * 0.10);
- }
- Console.WriteLine($"Apartment: {totalMoneyForApartment:f2} lv.");
- Console.WriteLine($"Studio: {totalMoneyForStudio:f2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement