Advertisement
IvanITD

04.FishingBoat

Jan 18th, 2024 (edited)
896
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.04 KB | Source Code | 0 0
  1. int groupBudget = int.Parse(Console.ReadLine());
  2. string season = Console.ReadLine();
  3. int fishersAmount = int.Parse(Console.ReadLine());
  4.  
  5. double rentPrice = 0.00;
  6.  
  7. if (season == "Spring")
  8. {
  9.     rentPrice = 3000;
  10.  
  11.     if (fishersAmount <= 6)
  12.     {
  13.         rentPrice -= (rentPrice * 0.10);
  14.     }
  15.     else if (fishersAmount >= 7 && fishersAmount <= 11)
  16.     {
  17.         rentPrice -= (rentPrice * 0.15);
  18.     }
  19.     else if (fishersAmount > 12)
  20.     {
  21.         rentPrice -= (rentPrice * 0.25);
  22.     }
  23.  
  24.     if (fishersAmount % 2 == 0)
  25.     {
  26.         rentPrice -= (rentPrice * 0.05);
  27.     }
  28. }
  29. else if (season == "Summer")
  30. {
  31.     rentPrice = 4200;
  32.  
  33.     if (fishersAmount <= 6)
  34.     {
  35.         rentPrice -= (rentPrice * 0.10);
  36.     }
  37.     else if (fishersAmount >= 7 && fishersAmount <= 11)
  38.     {
  39.         rentPrice -= (rentPrice * 0.15);
  40.     }
  41.     else if (fishersAmount > 12)
  42.     {
  43.         rentPrice -= (rentPrice * 0.25);
  44.     }
  45.  
  46.     if (fishersAmount % 2 == 0)
  47.     {
  48.         rentPrice -= (rentPrice * 0.05);
  49.     }
  50. }
  51. else if (season == "Autumn")
  52. {
  53.     rentPrice = 4200;
  54.  
  55.     if (fishersAmount <= 6)
  56.     {
  57.         rentPrice -= (rentPrice * 0.10);
  58.     }
  59.     else if (fishersAmount >= 7 && fishersAmount <= 11)
  60.     {
  61.         rentPrice -= (rentPrice * 0.15);
  62.     }
  63.     else if (fishersAmount > 12)
  64.     {
  65.         rentPrice -= (rentPrice * 0.25);
  66.     }
  67. }
  68. else if (season == "Winter")
  69. {
  70.     rentPrice = 2600;
  71.  
  72.     if (fishersAmount <= 6)
  73.     {
  74.         rentPrice -= (rentPrice * 0.10);
  75.     }
  76.     else if (fishersAmount >= 7 && fishersAmount <= 11)
  77.     {
  78.         rentPrice -= (rentPrice * 0.15);
  79.     }
  80.     else if (fishersAmount > 12)
  81.     {
  82.         rentPrice -= (rentPrice * 0.25);
  83.     }
  84.  
  85.     if (fishersAmount % 2 == 0)
  86.     {
  87.         rentPrice -= (rentPrice * 0.05);
  88.     }
  89. }
  90.  
  91. if (groupBudget >= rentPrice)
  92. {
  93.     Console.WriteLine($"Yes! You have {groupBudget - rentPrice:F2} leva left.");
  94. }
  95. else if (groupBudget < rentPrice)
  96. {
  97.     Console.WriteLine($"Not enough money! You need {rentPrice - groupBudget:F2} leva.");
  98. }
  99.  
  100.  
Tags: C#
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement