Advertisement
Alexander_B

Ski Trip

Feb 2nd, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.49 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace DomashnoSkiTrip
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int daysToStay = int.Parse(Console.ReadLine());
  14. string roomType = Console.ReadLine().ToLower();
  15. string feedBack = Console.ReadLine().ToLower();
  16.  
  17. double positiveFeedBackPercentageToAdd = 25;
  18. double negativeFeedBackPercentageDiscount = 10;
  19. double nightsToPay = daysToStay - 1;
  20. double discountForNight = 0;
  21.  
  22. double onePersonRoomPrice = 18;
  23. double apartmentPrice = 25.00;
  24. double presidentApartmentPrice = 35.00;
  25.  
  26. double totalCost = 0;
  27.  
  28. switch (roomType)
  29. {
  30. case "room for one person":
  31. {
  32. if (feedBack == "positive")
  33. {
  34.  
  35. totalCost = nightsToPay * onePersonRoomPrice * (1 + (1.00*positiveFeedBackPercentageToAdd/100));
  36. Console.WriteLine($"{totalCost:F2}");
  37. }
  38. else
  39. {
  40. totalCost = nightsToPay * onePersonRoomPrice * (1.00 - (1.00 * negativeFeedBackPercentageDiscount / 100));
  41. Console.WriteLine($"{totalCost:F2}");
  42. }
  43. }
  44. break;
  45. case "apartment":
  46. {
  47. switch (feedBack)
  48. {
  49. case "positive":
  50. if (daysToStay >= 0 && daysToStay < 10)
  51. {
  52. discountForNight = 30;
  53. totalCost = (nightsToPay * apartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 + (1.00*positiveFeedBackPercentageToAdd/100));
  54. Console.WriteLine($"{totalCost:F2}");
  55. }
  56. else if (daysToStay >= 10 && daysToStay <= 15)
  57. {
  58. discountForNight = 35;
  59. totalCost = (nightsToPay * apartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 + (1.00 * positiveFeedBackPercentageToAdd / 100));
  60. Console.WriteLine($"{totalCost:F2}");
  61. }
  62. else if (daysToStay > 15)
  63. {
  64. discountForNight = 50;
  65. totalCost = (nightsToPay * apartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 + (1.00 * positiveFeedBackPercentageToAdd / 100));
  66. Console.WriteLine($"{totalCost:F2}");
  67. }
  68. break;
  69. case "negative":
  70. if (daysToStay >= 0 && daysToStay < 10)
  71. {
  72. discountForNight = 30;
  73. totalCost = (nightsToPay * apartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1-(1.00 * negativeFeedBackPercentageDiscount / 100));
  74. Console.WriteLine($"{totalCost:F2}");
  75. }
  76. else if (daysToStay >= 10 && daysToStay <= 15)
  77. {
  78. discountForNight = 35;
  79. totalCost = (nightsToPay * apartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 - (1.00 * negativeFeedBackPercentageDiscount / 100));
  80. Console.WriteLine($"{totalCost:F2}");
  81. }
  82. else if (daysToStay > 15)
  83. {
  84. discountForNight = 50;
  85. totalCost = (nightsToPay * apartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 - (1.00 * negativeFeedBackPercentageDiscount / 100));
  86. Console.WriteLine($"{totalCost:F2}");
  87. }
  88. break;
  89. }
  90.  
  91. }
  92. break;
  93. case "president apartment":
  94. switch (feedBack)
  95. {
  96. case "positive":
  97. if (daysToStay >= 0 && daysToStay < 10)
  98. {
  99. discountForNight = 10;
  100. totalCost = (nightsToPay * presidentApartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 + (1.00 * positiveFeedBackPercentageToAdd / 100));
  101. Console.WriteLine($"{totalCost:F2}");
  102. }
  103. else if (daysToStay >= 10 && daysToStay <= 15)
  104. {
  105. discountForNight = 15;
  106. totalCost = (nightsToPay * presidentApartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 + (1.00 * positiveFeedBackPercentageToAdd / 100));
  107. Console.WriteLine($"{totalCost:F2}");
  108. }
  109. else if (daysToStay > 15)
  110. {
  111. discountForNight = 20;
  112. totalCost = (nightsToPay * presidentApartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 + (1.00 * positiveFeedBackPercentageToAdd / 100));
  113. Console.WriteLine($"{totalCost:F2}");
  114. }
  115. break;
  116. case "negative":
  117. if (daysToStay >= 0 && daysToStay < 10)
  118. {
  119. discountForNight = 10;
  120. totalCost = (nightsToPay * presidentApartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 - (1.00 * negativeFeedBackPercentageDiscount / 100));
  121. Console.WriteLine($"{totalCost:F2}");
  122. }
  123. else if (daysToStay >= 10 && daysToStay <= 15)
  124. {
  125. discountForNight = 15;
  126. totalCost = (nightsToPay * presidentApartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 - (1.00 * negativeFeedBackPercentageDiscount / 100));
  127. Console.WriteLine($"{totalCost:F2}");
  128. }
  129. else if (daysToStay > 15)
  130. {
  131. discountForNight = 20;
  132. totalCost = (nightsToPay * presidentApartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 - (1.00 * negativeFeedBackPercentageDiscount / 100));
  133. Console.WriteLine($"{totalCost:F2}");
  134. }
  135. break;
  136.  
  137. }
  138. break;
  139. }
  140. }
  141. }
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement