Advertisement
Guest User

Untitled

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