Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace DomashnoHotelRoom
- {
- class Program
- {
- static void Main(string[] args)
- {
- // get input --> string month - May, June, July, August, September, October; int nights;
- string month = Console.ReadLine().ToLower();
- int nights = int.Parse(Console.ReadLine());
- // calculate pricePerNight and allCost for apartment and studio
- double priceStudioMayOctober = 50.00;
- double priceStudioJuneSeptember = 75.20;
- double priceStudioJulyAugust = 76.00;
- double priceApartmentMayOctober = 65.00;
- double priceApartmentJuneSeptember = 68.70;
- double priceApartmentJulyAugust = 77.00;
- double allCostStudio = 0.00;
- double allCostApartment = 0.00;
- if (month == "may" || month == "october")
- {
- allCostStudio = priceStudioMayOctober * nights;
- allCostApartment = priceApartmentMayOctober * nights;
- }
- else if (month == "june" || month == "september")
- {
- allCostStudio = priceStudioJuneSeptember * nights;
- allCostApartment = priceApartmentJuneSeptember * nights;
- }
- else
- {
- allCostStudio = priceStudioJulyAugust * nights;
- allCostApartment = priceApartmentJulyAugust * nights;
- }
- // calculate discountPercent, according to nights and month
- double discountPercent = 0.00;
- double discountPercentApartmenMoreThanSevenNights = 10;
- if (nights > 7 && nights <= 14 && (month == "may" || month == "october"))
- {
- discountPercent = 5;
- }
- else if (nights > 14 && (month == "may" || month == "october"))
- {
- discountPercent = 30;
- }
- else if (nights > 14 && (month == "june" || month == "september"))
- {
- discountPercent = 20;
- }
- // calculate discountValue and allCostAftedDiscount for apartmen and studio
- double discountValueStudio = 0.00;
- double discountValueApartment = 0.00;
- if (nights > 7 && nights <= 14 && (month == "may" || month == "october"))
- {
- discountValueStudio = (1.00 * discountPercent / 100) * priceStudioMayOctober*nights;
- }
- else if (nights > 14 && (month == "may" || month == "october"))
- {
- discountValueStudio = (1.00 * discountPercent / 100) * priceStudioMayOctober*nights;
- discountValueApartment = (1.00 * discountPercentApartmenMoreThanSevenNights / 100) * priceApartmentMayOctober*nights;
- }
- else if (nights > 14 && (month == "june" || month == "september"))
- {
- discountValueStudio = (1.00 * discountPercent / 100) * priceStudioJuneSeptember*nights;
- discountValueApartment = (1.00 * discountPercentApartmenMoreThanSevenNights / 100) * priceApartmentJuneSeptember*nights;
- }
- else if (nights > 14 && (month == "july" || month == "august"))
- {
- discountValueApartment = (1.00 * discountPercentApartmenMoreThanSevenNights / 100) * priceApartmentJulyAugust*nights;
- }
- // print result --> “Apartment: {цена за целият престой} lv.”
- switch (month)
- {
- case "may":
- case "october":
- if (nights > 14)
- {
- allCostApartment -= discountValueApartment;
- }
- else
- {
- allCostApartment *= 1.00;
- }
- break;
- case "june":
- case "september":
- if (nights > 14)
- {
- allCostApartment -= discountValueApartment;
- }
- else
- {
- allCostApartment *= 1.00;
- }
- break;
- case "july":
- case "august":
- if (nights > 14)
- {
- allCostApartment -= discountValueApartment;
- }
- else
- {
- allCostApartment *= 1.00;
- }
- break;
- }
- Console.WriteLine($"Apartment: {allCostApartment:f2} lv.");
- // print result --> “Studio: {цена за целият престой} lv.“
- switch (month)
- {
- case "may":
- case "october":
- if (nights > 7 && nights <= 14)
- {
- allCostStudio -= discountValueStudio;
- }
- else if (nights > 14)
- {
- allCostStudio -= discountValueStudio;
- }
- else
- {
- allCostStudio *= 1.00;
- }
- break;
- case "june":
- case "september":
- if (nights > 14)
- {
- allCostStudio -= discountValueStudio;
- }
- else
- {
- allCostStudio *= 1.00;
- }
- break;
- case "july":
- case "august":
- allCostStudio *= 1.00;
- break;
- }
- Console.WriteLine($"Studio: {allCostStudio:f2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement