Advertisement
ZuRi4i

Untitled

Dec 6th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Reservation
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int reservationDay = int.Parse(Console.ReadLine());
  10. int reservationMonth = int.Parse(Console.ReadLine());
  11. int accommodationDay = int.Parse(Console.ReadLine());
  12. int accommodationMonth = int.Parse(Console.ReadLine());
  13. int leaveDay = int.Parse(Console.ReadLine());
  14. int leaveMonth = int.Parse(Console.ReadLine());
  15.  
  16. double roomPriceWithoutDiscount = 30;
  17. double roomPriceTenDayBefore = 25;
  18. double roomPricePreviousMonth = 25 - (0.20 * 25);
  19.  
  20. double nights = accommodationDay - leaveDay;
  21. double cost = 0;
  22. if (reservationMonth < accommodationMonth && reservationDay < accommodationDay)
  23. {
  24. cost = nights * roomPricePreviousMonth;
  25. }
  26. else if (reservationMonth == accommodationMonth && reservationDay < (accommodationDay - 10))
  27. {
  28. cost = nights * roomPriceTenDayBefore;
  29. }
  30. else
  31. {
  32. cost = nights * roomPriceWithoutDiscount;
  33. }
  34.  
  35. cost = Math.Abs(cost);
  36.  
  37. Console.WriteLine($"Your stay from {accommodationDay}/{accommodationMonth} to {leaveDay}/{leaveMonth} will cost {cost:f2}");
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement