Teo_Yanchev

3.Vacation - C# Fundamentals

Sep 17th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. using System.Threading;
  4.  
  5. namespace demo
  6. {
  7. class Program
  8. {
  9. static void Main()
  10. {
  11. int people = int.Parse(Console.ReadLine());
  12. string typeGroup = Console.ReadLine();
  13. string day = Console.ReadLine();
  14.  
  15. decimal total = 0.00m;
  16.  
  17. if (typeGroup == "Business" && people >= 100)
  18. {
  19. people -= 10;
  20. }
  21.  
  22. if (day == "Friday")
  23. {
  24. if (typeGroup == "Students")
  25. {
  26. total = people * 8.45m;
  27. }
  28.  
  29. else if (typeGroup == "Business")
  30. {
  31. total = people * 10.90m;
  32. }
  33.  
  34. else if (typeGroup == "Regular")
  35. {
  36. total = people * 15.00m;
  37. }
  38. }
  39.  
  40. else if (day == "Saturday")
  41. {
  42. if (typeGroup == "Students")
  43. {
  44. total = people * 9.80m;
  45. }
  46.  
  47. else if (typeGroup == "Business")
  48. {
  49. total = people * 15.60m;
  50. }
  51.  
  52. else if (typeGroup == "Regular")
  53. {
  54. total = people * 20.00m;
  55. }
  56. }
  57.  
  58. else if (day == "Sunday")
  59. {
  60. if (typeGroup == "Students")
  61. {
  62. total = people * 10.46m;
  63. }
  64.  
  65. else if (typeGroup == "Business")
  66. {
  67. total = people * 16.00m;
  68. }
  69.  
  70. else if (typeGroup == "Regular")
  71. {
  72. total = people * 22.50m;
  73. }
  74. }
  75.  
  76. if (typeGroup == "Students" && people >= 30)
  77. {
  78. total *= 0.85m;
  79. }
  80.  
  81. bool checkNumberOfRegulars = 10 <= people && people <= 20;
  82. if (typeGroup == "Regular" && checkNumberOfRegulars)
  83. {
  84. total *= 0.95m;
  85. }
  86. Console.WriteLine($"Total price: {total:F2}");
  87.  
  88. }
  89. }
  90. }
  91.  
Advertisement
Add Comment
Please, Sign In to add comment