Advertisement
spasnikolov131

Untitled

May 13th, 2021
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Conditional_Statements_Advanced___More_Exercises
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double vip = 499.99;
  10. double normal = 249.99;
  11.  
  12. double budget = double.Parse(Console.ReadLine());
  13. string category = Console.ReadLine();
  14. double people = double.Parse(Console.ReadLine());
  15. double transportniRazhodi = 0;
  16.  
  17. if (people > 1 && people <= 4)
  18. {
  19. transportniRazhodi = budget - (75 * budget / 100);
  20. if (category == "Normal")
  21. {
  22. double ticketCost = normal * people;
  23. }
  24. else
  25. {
  26. double ticketCost = vip * people;
  27. }
  28. }
  29. else if (people >= 5 && people <= 9)
  30. {
  31. transportniRazhodi = budget - (60 * budget / 100);
  32. if (category == "Normal")
  33. {
  34. double ticketCost = normal * people;
  35. }
  36. else
  37. {
  38. double ticketCost = vip * people;
  39. }
  40. }
  41. else if (people >= 10 && people <= 24)
  42. {
  43. transportniRazhodi = budget - (50 * budget / 100);
  44. if (category == "Normal")
  45. {
  46. double ticketCost = normal * people;
  47. }
  48. else
  49. {
  50. double ticketCost = vip * people;
  51. }
  52. }
  53. else if (people >= 25 && people <= 49)
  54. {
  55. transportniRazhodi = budget - (40 * budget / 100);
  56. if (category == "Normal")
  57. {
  58. double ticketCost = normal * people;
  59. }
  60. else
  61. {
  62. double ticketCost = vip * people;
  63. }
  64. }
  65. else if (people >= 50)
  66. {
  67. transportniRazhodi = budget - (25 * budget / 100);
  68. if (category == "Normal")
  69. {
  70. double ticketCost = normal * people;
  71. }
  72. else
  73. {
  74. double ticketCost = vip * people;
  75. }
  76. }
  77. if (ticketCost < transportniRazhodi)
  78. {
  79. Console.WriteLine($"Yes! You have {transportniRazhodi - ticketCost:f2} leva left.");
  80. }
  81. else
  82. {
  83. Console.WriteLine($"Not enough money! You need {ticketCost - transportniRazhodi} leva.");
  84. }
  85. }
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement