Advertisement
spasnikolov131

Untitled

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