Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Hotel_Room
- {
- class Program
- {
- static void Main(string[] args)
- {
- string month = Console.ReadLine();
- int countOfNights = int.Parse(Console.ReadLine());
- double studioPerNight = 0;
- double apartmentPerNight = 0;
- double totalPriceStudio = 0;
- double totalPriceApartment = 0;
- bool flag = true;
- switch (month)
- {
- case "May":
- break;
- case "June":
- break;
- case "July":
- break;
- case "August":
- break;
- case "September":
- break;
- case "October":
- break;
- default:
- flag = false;
- break;
- }
- if (flag)
- {
- if (month == "May" || month == "October")
- {
- apartmentPerNight = 65;
- studioPerNight = 50;
- if (countOfNights > 7 && countOfNights <= 14)
- {
- studioPerNight = studioPerNight - studioPerNight * 0.05;
- totalPriceStudio = countOfNights * studioPerNight;
- }
- else if (countOfNights >= 14)
- {
- studioPerNight = studioPerNight - studioPerNight * 0.3;
- totalPriceStudio = countOfNights * studioPerNight;
- apartmentPerNight = apartmentPerNight - apartmentPerNight * 0.1;
- totalPriceApartment = countOfNights * apartmentPerNight;
- }
- totalPriceApartment = countOfNights * apartmentPerNight;
- totalPriceStudio = countOfNights * studioPerNight;
- }
- else if (month == "June" || month == "September")
- {
- studioPerNight = 75.20;
- apartmentPerNight = 68.70;
- if (countOfNights > 14)
- {
- studioPerNight = studioPerNight - studioPerNight * 0.2;
- totalPriceStudio = countOfNights * studioPerNight;
- apartmentPerNight = apartmentPerNight - apartmentPerNight * 0.1;
- totalPriceApartment = countOfNights * apartmentPerNight;
- }
- totalPriceStudio = countOfNights * studioPerNight;
- totalPriceApartment = countOfNights * apartmentPerNight;
- }
- else if (month == "July" || month == "August")
- {
- studioPerNight = 76;
- apartmentPerNight = 77;
- if (countOfNights > 14)
- {
- apartmentPerNight = apartmentPerNight - apartmentPerNight * 0.1;
- totalPriceApartment = countOfNights * apartmentPerNight;
- }
- totalPriceStudio = countOfNights * studioPerNight;
- totalPriceApartment = countOfNights * apartmentPerNight;
- }
- }
- Console.WriteLine($"Apartment: {totalPriceApartment:f2} lv.");
- Console.WriteLine($"Studio: {totalPriceStudio:f2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement