Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _09._Ski_Trip
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int days = int.Parse(Console.ReadLine()); //дни престой
- string roomType = Console.ReadLine(); //"room for one person", "apartment" или "president apartment"
- string feedback = Console.ReadLine(); //"positive" или "negative"
- //1. крайна цена за престоя = бр. нощувки * цена за 1 нощувка
- int nights = days - 1; //бр. нощувки
- double pricePerNight = 0; //цена за 1 нощувка -> зависи от тип на стаята
- //roomType -> серия от проверки за точни стойности
- //"room for one person" – 18.00 лв за нощувка
- //"apartment" – 25.00 лв за нощувка
- //"president apartment" – 35.00 лв за нощувка
- switch (roomType)
- {
- case "room for one person":
- pricePerNight = 18;
- break;
- case "apartment":
- pricePerNight = 25;
- break;
- case "president apartment":
- pricePerNight = 35;
- break;
- }
- double totalPrice = nights * pricePerNight; // крайна цена
- //2. отстъпки
- if (roomType == "apartment")
- {
- //проверка за дните
- if (days < 10)
- {
- //-30%
- totalPrice = totalPrice - 0.30 * totalPrice;
- }
- else if (days >= 10 && days <= 15)
- {
- //-35%
- totalPrice = totalPrice - 0.35 * totalPrice;
- }
- else if (days > 15)
- {
- //-50%
- totalPrice = totalPrice - 0.50 * totalPrice;
- }
- }
- else if (roomType == "president apartment")
- {
- //проверка за дните
- if (days < 10)
- {
- //-10%
- totalPrice = totalPrice - 0.10 * totalPrice;
- }
- else if (days >= 10 && days <= 15)
- {
- //-15%
- totalPrice = totalPrice - 0.15 * totalPrice;
- }
- else if (days > 15)
- {
- //-20%
- totalPrice = totalPrice - 0.20 * totalPrice;
- }
- }
- //3. допълнителни отстъпки / намаления -> зависят от feedback
- if (feedback == "positive")
- {
- //+25%
- totalPrice = totalPrice + 0.25 * totalPrice;
- }
- else if (feedback == "negative")
- {
- //-10%
- totalPrice = totalPrice - 0.10 * totalPrice;
- }
- //4. печатане на крайната сума след всички отстъпки
- Console.WriteLine($"{totalPrice:F2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement