Advertisement
Guest User

Untitled

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