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 hotel_room
- {
- class Program
- {
- static double PricePerNightStudio(string month)
- {
- double priceStudio = 0;
- if (month == "May" || month == "October")
- {
- priceStudio = 50.00;
- }
- else if (month == "June" || month == "September")
- {
- priceStudio = 75.20;
- }
- else if (month == "July" || month == "August")
- {
- priceStudio = 76.00;
- }
- return priceStudio;
- }
- static double PricePerNightApartment(string month)
- {
- double priceApartment = 0;
- if (month == "May" || month == "October")
- {
- priceApartment = 65.00;
- }
- else if (month == "June" || month == "September")
- {
- priceApartment = 68.70;
- }
- else if (month == "July" || month == "August")
- {
- priceApartment = 77.00;
- }
- return priceApartment;
- }
- static double PriceWithDiscountStudio(string month, double nights, double totalPrice)
- {
- double priceWithDiscount = 0;
- if ((nights > 7 && nights <= 14) && (month == "May" || month == "October"))
- {
- priceWithDiscount = totalPrice - totalPrice * 0.05;
- }
- if (nights > 14 && (month == "May" || month == "October"))
- {
- priceWithDiscount = totalPrice - totalPrice * 0.30;
- }
- else if (nights > 14 && (month == "June" || month == "September"))
- {
- priceWithDiscount = totalPrice - totalPrice * 0.20;
- }
- else if (nights == 0)
- {
- priceWithDiscount = 0.00;
- }
- else
- priceWithDiscount = totalPrice;
- return priceWithDiscount;
- }
- static double PriceWithDiscountApartment(string month, double nights, double totalPrice)
- {
- double priceWithDiscount = 0;
- if (nights > 14)
- {
- priceWithDiscount = totalPrice - totalPrice * 0.10;
- }
- else if (nights == 0)
- {
- priceWithDiscount = 0.00;
- }
- else
- priceWithDiscount = totalPrice;
- return priceWithDiscount;
- }
- static void Main(string[] args)
- {
- //May, June, July, August, September или October
- string month = Console.ReadLine();
- int nights = int.Parse(Console.ReadLine());
- double priceStudio = nights * PricePerNightStudio(month);
- double priceApartment = nights * PricePerNightApartment(month);
- priceStudio = PriceWithDiscountStudio(month, nights, priceStudio);
- priceApartment = PriceWithDiscountApartment(month, nights, priceApartment);
- Console.WriteLine($"Apartment: {Math.Round(priceApartment, 2):f2} lv.");
- Console.WriteLine($"Studio: {Math.Round(priceStudio, 2):f2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement