Advertisement
Guest User

Untitled

a guest
May 9th, 2020
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _05._Fishing_Boat
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int budget = int.Parse(Console.ReadLine());
  10. string seson = Console.ReadLine();
  11. int numberFishermans = int.Parse(Console.ReadLine());
  12.  
  13. double priceBoat = 0.00;
  14. double promo = 1.00;
  15. double extrapromo = 1.00;
  16.  
  17. if (seson == "Spring")
  18. {
  19. priceBoat = 3000.00;
  20. }
  21. else if (seson == "Summer" || seson == "Autumn")
  22. {
  23. priceBoat = 4200.00;
  24. }
  25. else if (seson == "Winter")
  26. {
  27. priceBoat = 2600.00;
  28. }
  29. if (numberFishermans <= 6)
  30. {
  31. promo = 0.90;
  32. }
  33. else if (numberFishermans > 7 && numberFishermans <= 11)
  34. {
  35. promo = 0.85;
  36. }
  37. else if (numberFishermans > 12)
  38. {
  39. promo = 0.75;
  40. }
  41. if ((numberFishermans % 2 == 0) && seson != "Autumn")
  42. {
  43. extrapromo = 0.95;
  44. }
  45. double finPrice = (priceBoat * promo) * extrapromo;
  46. double balance = budget - finPrice;
  47. if (balance >= 0)
  48. {
  49. Console.WriteLine($"Yes! You have {balance:F2} leva left.");
  50. }
  51. else if (balance < 0)
  52. {
  53. balance = balance * -1;
  54. Console.WriteLine($"Not enough money! You need {balance:F2} leva.");
  55. }
  56. }
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement