Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. using System;
  2.  
  3. namespace fishingBoat
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. // ⦁ Бюджет на групата – цяло число в интервала[1…8000]
  10. // ⦁ Сезон – текст: "Spring", "Summer", "Autumn", "Winter"
  11. // ⦁ Брой рибари – цяло число в интервала[4…18]
  12.  
  13. int budget = int.Parse(Console.ReadLine());
  14. string season = Console.ReadLine();
  15. int fisheMan = int.Parse(Console.ReadLine());
  16.  
  17. double totPrise = 0.0;
  18. //"Spring", "Summer", "Autumn", "Winter"
  19.  
  20. if (season == "Spring")
  21. {
  22. totPrise = 3000;
  23. }
  24. else if (season == "Summer" || season == "Autumn")
  25. {
  26. totPrise = 4200;
  27. }
  28. else if (season == "Winter")
  29. {
  30. totPrise = 2600;
  31. }
  32.  
  33.  
  34. if (fisheMan <= 6)
  35. {
  36. totPrise = totPrise * 0.90;
  37. }
  38. else if (fisheMan >= 7 && fisheMan <= 11)
  39. {
  40. totPrise = totPrise * 0.85;
  41. }
  42. else if (fisheMan >= 12)
  43. {
  44. totPrise = totPrise * 0.75;
  45. }
  46. else if (season == "Winter" || season == "Summer" || season == "Spring")
  47. {
  48. if (fisheMan % 2 == 0)
  49. {
  50. totPrise = totPrise * 0.95;
  51. }
  52. }
  53.  
  54. double moneyleft = budget - totPrise;
  55. string output = string.Empty;
  56.  
  57.  
  58. if (budget >= totPrise)
  59. {
  60. output = $"Yes! You have {moneyleft:f2} leva left.";
  61.  
  62. }
  63. else
  64. {
  65.  
  66. output = $"Not enough money! You need {Math.Abs(moneyleft):f2} leva.";
  67. }
  68.  
  69. Console.WriteLine(output);
  70.  
  71.  
  72. }
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement