Advertisement
Guest User

Untitled

a guest
Jul 15th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.75 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp14
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int budget = int.Parse(Console.ReadLine());
  10. string season = Console.ReadLine();
  11. int numberOfFishers = int.Parse(Console.ReadLine());
  12. double discountForSeason;
  13. double discountForEven;
  14. double price = 0.0;
  15. double moneyLeft;
  16. double moneyNeed;
  17. int priceForBoatInSpring = 3000;
  18. int priceForBoatInSummerAndAutumn = 4200;
  19. int priceForBoatInWinter = 2600;
  20. switch (season)
  21. {
  22. case "Spring":
  23. if (numberOfFishers <= 6)
  24. {
  25. if (numberOfFishers % 2 == 0)
  26. {
  27. discountForSeason = (priceForBoatInSpring / 100) * 10;
  28. discountForEven = (priceForBoatInSpring / 100) * 5;
  29. price = priceForBoatInSpring - discountForEven - discountForSeason;
  30. }
  31. else
  32. {
  33. discountForSeason = (priceForBoatInSpring / 100) * 10;
  34. price = priceForBoatInSpring - discountForSeason;
  35. }
  36. }
  37.  
  38. else if (numberOfFishers >= 7 && numberOfFishers <= 11)
  39. {
  40. if (numberOfFishers % 2 == 0)
  41. {
  42. discountForSeason = (priceForBoatInSpring / 100) * 15;
  43. discountForEven = (priceForBoatInSpring / 100) * 5;
  44. price = priceForBoatInSpring - discountForEven - discountForSeason;
  45. }
  46. else
  47. {
  48. discountForSeason = (priceForBoatInSpring / 100) * 10;
  49. price = priceForBoatInSpring - discountForSeason;
  50. }
  51. }
  52.  
  53. else if (numberOfFishers >= 12)
  54. {
  55. if (numberOfFishers % 2 == 0)
  56. {
  57. discountForSeason = (priceForBoatInSpring / 100) * 25;
  58. discountForEven = (priceForBoatInSpring / 100) * 5;
  59. price = priceForBoatInSpring - discountForEven - discountForSeason;
  60. }
  61. else
  62. {
  63. discountForSeason = (priceForBoatInSpring / 100) * 10;
  64. price = priceForBoatInSpring - discountForSeason;
  65. }
  66. }
  67.  
  68. break;
  69.  
  70. case "Summer":
  71. if (numberOfFishers <= 6)
  72. {
  73. if (numberOfFishers % 2 == 0)
  74. {
  75. discountForSeason = (priceForBoatInSummerAndAutumn / 100) * 10;
  76. discountForEven = (priceForBoatInSummerAndAutumn / 100) * 5;
  77. price = priceForBoatInSummerAndAutumn - discountForEven - discountForSeason;
  78. }
  79. else
  80. {
  81. discountForSeason = (priceForBoatInSummerAndAutumn / 100) * 10;
  82. price = priceForBoatInSummerAndAutumn - discountForSeason;
  83. }
  84. }
  85.  
  86. else if (numberOfFishers >= 7 && numberOfFishers <= 11)
  87. {
  88. if (numberOfFishers % 2 == 0)
  89. {
  90. discountForSeason = (priceForBoatInSummerAndAutumn / 100) * 15;
  91. discountForEven = (priceForBoatInSummerAndAutumn / 100) * 5;
  92. price = priceForBoatInSummerAndAutumn - discountForEven - discountForSeason;
  93. }
  94. else
  95. {
  96. discountForSeason = (priceForBoatInSummerAndAutumn / 100) * 15;
  97. price = priceForBoatInSummerAndAutumn - discountForSeason;
  98. }
  99. }
  100.  
  101. else if (numberOfFishers >= 12)
  102. {
  103. if (numberOfFishers % 2 == 0)
  104. {
  105. discountForSeason = (priceForBoatInSummerAndAutumn / 100) * 25;
  106. discountForEven = (priceForBoatInSummerAndAutumn / 100) * 5;
  107. price = priceForBoatInSummerAndAutumn - discountForEven - discountForSeason;
  108. }
  109. else
  110. {
  111. discountForSeason = (priceForBoatInSummerAndAutumn / 100) * 25;
  112. price = priceForBoatInSummerAndAutumn - discountForSeason;
  113. }
  114. }
  115. break;
  116.  
  117. case "Autumn":
  118. if (numberOfFishers <= 6)
  119. {
  120. discountForSeason = (priceForBoatInSummerAndAutumn / 100) * 10;
  121. price = priceForBoatInSummerAndAutumn - discountForSeason;
  122.  
  123. }
  124.  
  125. else if (numberOfFishers >= 7 && numberOfFishers <= 11)
  126. {
  127. discountForSeason = (priceForBoatInSummerAndAutumn / 100) * 15;
  128. price = priceForBoatInSummerAndAutumn - discountForSeason;
  129. }
  130.  
  131. else if (numberOfFishers >= 12)
  132. {
  133. discountForSeason = (priceForBoatInSummerAndAutumn / 100) * 25;
  134. price = priceForBoatInSummerAndAutumn - discountForSeason;
  135.  
  136. }
  137. break;
  138.  
  139. case "Winter":
  140. if (numberOfFishers <= 6)
  141. {
  142. if (numberOfFishers % 2 == 0)
  143. {
  144. discountForSeason = (priceForBoatInWinter / 100) * 10;
  145. discountForEven = (priceForBoatInWinter / 100) * 5;
  146. price = priceForBoatInWinter - discountForEven - discountForSeason;
  147. }
  148. else
  149. {
  150. discountForSeason = (priceForBoatInWinter / 100) * 10;
  151. price = priceForBoatInWinter - discountForSeason;
  152. }
  153. }
  154.  
  155. else if (numberOfFishers >= 7 && numberOfFishers <= 11)
  156. {
  157. if (numberOfFishers % 2 == 0)
  158. {
  159. discountForSeason = (priceForBoatInWinter / 100) * 15;
  160. discountForEven = (priceForBoatInWinter / 100) * 5;
  161. price = priceForBoatInWinter - discountForEven - discountForSeason;
  162. }
  163. else
  164. {
  165. discountForSeason = (priceForBoatInWinter / 100) * 15;
  166. price = priceForBoatInWinter - discountForSeason;
  167. }
  168. }
  169.  
  170. else if (numberOfFishers >= 12)
  171. {
  172. if (numberOfFishers % 2 == 0)
  173. {
  174. discountForSeason = (priceForBoatInWinter / 100) * 25;
  175. discountForEven = (priceForBoatInWinter / 100) * 5;
  176. price = priceForBoatInWinter - discountForEven - discountForSeason;
  177. }
  178. else
  179. {
  180. discountForSeason = (priceForBoatInWinter / 100) * 25;
  181. price = priceForBoatInWinter - discountForSeason;
  182. }
  183. }
  184. break;
  185. }
  186.  
  187. if (budget > price)
  188. {
  189. moneyLeft = budget - price;
  190. Console.WriteLine($"Yes! You have {moneyLeft:F2} leva left.");
  191. }
  192. else
  193. {
  194. moneyNeed = price - budget;
  195. Console.WriteLine($"Not enough money! You need {moneyNeed:F2} leva.");
  196. }
  197. }
  198. }
  199. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement