Advertisement
KrasenPenev

fishBoat

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