Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Reservation
- {
- class Program
- {
- static void Main(string[] args)
- {
- int reservationDay = int.Parse(Console.ReadLine());
- int reservationMonth = int.Parse(Console.ReadLine());
- int accommodationDay = int.Parse(Console.ReadLine());
- int accommodationMonth = int.Parse(Console.ReadLine());
- int leaveDay = int.Parse(Console.ReadLine());
- int leaveMonth = int.Parse(Console.ReadLine());
- double roomPriceWithoutDiscount = 30;
- double roomPriceTenDayBefore = 25;
- double roomPricePreviousMonth = 25 - (0.20 * 25);
- double nights = accommodationDay - leaveDay;
- double cost = 0;
- if (reservationMonth < accommodationMonth && reservationDay < accommodationDay)
- {
- cost = nights * roomPricePreviousMonth;
- }
- else if (reservationMonth == accommodationMonth && reservationDay < (accommodationDay - 10))
- {
- cost = nights * roomPriceTenDayBefore;
- }
- else
- {
- cost = nights * roomPriceWithoutDiscount;
- }
- cost = Math.Abs(cost);
- Console.WriteLine($"Your stay from {accommodationDay}/{accommodationMonth} to {leaveDay}/{leaveMonth} will cost {cost:f2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement