Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _07._Hotel_Room
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- string month = Console.ReadLine(); //May, June, July, August, September или October
- int nights = int.Parse(Console.ReadLine()); //бр. нощувки
- //1. крайна цена за студио = бр. нощувки (nights) * цена за 1 нощувка в студио
- double pricePerNightStudio = 0; //цена за 1 нощувка в студио -> зависи от месеца
- //2. крайна цена за апартамент = бр. нощувки (nights) * цена за 1 нощувка в апартамент
- double pricePerNightApartment = 0; //цена за 1 нощувка в апартамент -> зависи от месеца
- if (month == "May" || month == "October")
- {
- pricePerNightStudio = 50;
- pricePerNightApartment = 65;
- }
- else if (month == "June" || month == "September")
- {
- pricePerNightStudio = 75.20;
- pricePerNightApartment = 68.70;
- }
- else if (month == "July" || month == "August")
- {
- pricePerNightStudio = 76;
- pricePerNightApartment = 77;
- }
- double totalPriceStudio = nights * pricePerNightStudio; //крайна цена за студио
- double totalPriceApartment = nights * pricePerNightApartment; //крайна цена за апартамент
- //3. остъпки върху крайни цени
- //3.1. отстъпки за студио
- //повече от 14 нощувки през май и октомври -> -30% за студио
- if (nights > 14 && (month == "May" || month == "October"))
- {
- totalPriceStudio = totalPriceStudio - 0.30 * totalPriceStudio;
- }
- //повече от 7 нощувки през май и октомври -> -5% за студио
- else if (nights > 7 && (month == "May" || month == "October"))
- {
- totalPriceStudio = totalPriceStudio - 0.05 * totalPriceStudio;
- }
- //повече от 14 нощувки през юни и септември -> -20% за студио
- else if (nights > 14 && (month == "June" || month == "September"))
- {
- totalPriceStudio = totalPriceStudio - 0.20 * totalPriceStudio;
- }
- //3.2 отстъпки за апартамент
- //при повече от 14 нощувки -> -10% за апартамент
- if (nights > 14)
- {
- totalPriceApartment = totalPriceApartment - 0.10 * totalPriceApartment;
- }
- //4. отпечатване
- Console.WriteLine($"Apartment: {totalPriceApartment:F2} lv.");
- Console.WriteLine($"Studio: {totalPriceStudio:F2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement