Stanislavgr

05.Fishing boat__Nested Conditional Statements

Apr 2nd, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 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 _05.Fishing_Boat
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double groupBudget = double.Parse(Console.ReadLine());
  14. string season = Console.ReadLine();
  15. double fishersCount = double.Parse(Console.ReadLine());
  16.  
  17. double currentPrice = 0;
  18. double totalPrice = 0;
  19.  
  20. if (season == "Spring")
  21. {
  22. if (fishersCount <= 6)
  23. {
  24. currentPrice = 3000;
  25. totalPrice = currentPrice - (currentPrice * 10 / 100);
  26. }
  27. else if (fishersCount > 6 && fishersCount <= 11)
  28. {
  29. currentPrice = 3000;
  30. totalPrice = currentPrice - (currentPrice * 15 / 100);
  31. }
  32. else if (fishersCount > 11)
  33. {
  34. currentPrice = 3000;
  35. totalPrice = currentPrice - (currentPrice * 25 / 100);
  36. }
  37.  
  38. }
  39. else if (season == "Summer")
  40. {
  41. if (fishersCount <= 6)
  42. {
  43. currentPrice = 4200;
  44. totalPrice = currentPrice - (currentPrice * 10 / 100);
  45. }
  46. else if (fishersCount > 6 && fishersCount <= 11)
  47. {
  48. currentPrice = 4200;
  49. totalPrice = currentPrice - (currentPrice * 15 / 100);
  50. }
  51. else if (fishersCount > 11)
  52. {
  53. currentPrice = 4200;
  54. totalPrice = currentPrice - (currentPrice * 25 / 100);
  55. }
  56. }
  57. else if (season == "Winter")
  58. {
  59. if (fishersCount <= 6)
  60. {
  61. currentPrice = 2600;
  62. totalPrice = currentPrice - (currentPrice * 10 / 100);
  63. }
  64. else if (fishersCount > 6 && fishersCount <= 11)
  65. {
  66. currentPrice = 2600;
  67. totalPrice = currentPrice - (currentPrice * 15 / 100);
  68. }
  69. else if (fishersCount > 11)
  70. {
  71. currentPrice = 2600;
  72. totalPrice = currentPrice - (currentPrice * 25 / 100);
  73. }
  74.  
  75. }
  76. else if (season == "Autumn")
  77. {
  78. if (fishersCount <= 6)
  79. {
  80. currentPrice = 4200;
  81. totalPrice = currentPrice - (currentPrice * 10 / 100);
  82. }
  83. else if (fishersCount > 6 && fishersCount <= 11)
  84. {
  85. currentPrice = 4200;
  86. totalPrice = currentPrice - (currentPrice * 15 / 100);
  87. }
  88. else if(fishersCount > 11)
  89. {
  90. currentPrice = 4200;
  91. totalPrice = currentPrice - (currentPrice * 25 / 100);
  92. }
  93. }
  94.  
  95. double moneyMiss = Math.Abs(groupBudget- totalPrice);
  96.  
  97.  
  98. if (season == "Spring" || season == "Summer" || season == "Winter" && fishersCount % 2 == 0)
  99. {
  100. totalPrice = totalPrice - (totalPrice * 5 / 100);
  101.  
  102. }
  103.  
  104. if (groupBudget < totalPrice)
  105. {
  106. Console.WriteLine($"Not enough money! You need {moneyMiss:f2} leva.");
  107. }
  108. else if (groupBudget >= totalPrice)
  109. {
  110. Console.WriteLine($"Yes! You have {moneyMiss:f2} leva left.");
  111. }
  112.  
  113.  
  114.  
  115.  
  116.  
  117. }
  118. }
  119. }
Advertisement
Add Comment
Please, Sign In to add comment