Advertisement
kzborisov

Untitled

Oct 28th, 2018
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 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 forum
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. //1. Read Input
  15. int budget = int.Parse(Console.ReadLine());
  16. string season = Console.ReadLine();
  17. int fishermanCount = int.Parse(Console.ReadLine());
  18.  
  19. //2. Manipulate Data
  20. double boatReant = 0;
  21. switch (season)
  22. {
  23. case "Spring":
  24. boatReant = 3000;
  25. break;
  26. case "Summer":
  27. case "Autumn":
  28. boatReant = 4200;
  29. break;
  30. case "Winter":
  31. boatReant = 2600;
  32. break;
  33. }
  34.  
  35. if (fishermanCount <= 6)
  36. boatReant -= boatReant * 0.1;
  37. else if (fishermanCount >= 7 && fishermanCount <= 11)
  38. boatReant -= boatReant * 0.15;
  39. else
  40. boatReant -= boatReant * 0.25;
  41.  
  42. if (fishermanCount % 2 == 0 && season != "Autumn")
  43. boatReant -= boatReant * 0.05;
  44.  
  45. //3. Print Result
  46. double moneyResult = Math.Abs(budget - boatReant);
  47. if (budget >= boatReant)
  48. {
  49. Console.WriteLine($"Yes! You have {moneyResult:F2} leva left.");
  50. }
  51. else
  52. {
  53. Console.WriteLine($"Not enough money! You need {moneyResult:F2} leva.");
  54. }
  55.  
  56. }
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement