Advertisement
daxtera

Untitled

Mar 21st, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Default
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string day = Console.ReadLine();
  10. int age = int.Parse(Console.ReadLine());
  11. int ticketPrice = 0;
  12.  
  13. if (day == "Weekday")
  14. {
  15. if (0 <= age && age <= 18)
  16. {
  17. ticketPrice = 12;
  18. }
  19. else if (18 <= age && age <= 64)
  20. {
  21. ticketPrice = 18;
  22.  
  23. }
  24. else if (64 <= age && age <= 122)
  25. {
  26. ticketPrice = 12;
  27. }
  28. }
  29.  
  30. if (day == "Weekend")
  31. {
  32. if (0 <= age && age <= 18)
  33. {
  34. ticketPrice = 15;
  35. }
  36. else if (18 <= age && age <= 64)
  37. {
  38. ticketPrice = 20;
  39.  
  40. }
  41. else if (64 <= age && age <= 122)
  42. {
  43. ticketPrice = 15;
  44. }
  45.  
  46.  
  47. }
  48. if (day == "Holiday")
  49. {
  50. if (0 <= age && age <= 18)
  51. {
  52. ticketPrice = 5;
  53. }
  54. else if (18 <= age && age <= 64)
  55. {
  56. ticketPrice = 12;
  57.  
  58. }
  59. else if (64 <= age && age <= 122)
  60. {
  61. ticketPrice = 10;
  62. }
  63.  
  64.  
  65.  
  66. }
  67. if (ticketPrice != 0)
  68. {
  69. Console.WriteLine(ticketPrice + "$");
  70.  
  71. }
  72. else
  73. {
  74. Console.WriteLine("Error!");
  75. }
  76.  
  77. }
  78. }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement