fork download
  1. namespace Problem_6.Theatre_Promotions
  2. {
  3. using System;
  4.  
  5. public class Program
  6. {
  7. public static void Main()
  8. {
  9. var dayType = Console.ReadLine();
  10. var age = int.Parse(Console.ReadLine());
  11.  
  12. if (dayType == "Weekday")
  13. {
  14. if (age >= 0 && age <= 18)
  15. {
  16. Console.WriteLine("12$");
  17. }
  18.  
  19. else if (age > 18 && age <= 64)
  20. {
  21. Console.WriteLine("18$");
  22. }
  23.  
  24. else if (age > 64 && age <= 122)
  25. {
  26. Console.WriteLine("12$");
  27. }
  28.  
  29. else
  30. {
  31. Console.WriteLine("Error!");
  32. }
  33. }
  34.  
  35. else if (dayType == "Weekend")
  36. {
  37. if (age >= 0 && age <= 18)
  38. {
  39. Console.WriteLine("15$");
  40. }
  41.  
  42. else if (age > 18 && age <= 64)
  43. {
  44. Console.WriteLine("20$");
  45. }
  46.  
  47. else if (age > 64 && age <= 122)
  48. {
  49. Console.WriteLine("15$");
  50. }
  51.  
  52. else
  53. {
  54. Console.WriteLine("Error!");
  55. }
  56. }
  57.  
  58. else if (dayType == "Holiday")
  59. {
  60. if (age >= 0 && age <= 18)
  61. {
  62. Console.WriteLine("5$");
  63. }
  64.  
  65. else if (age > 18 && age <= 64)
  66. {
  67. Console.WriteLine("12$");
  68. }
  69.  
  70. else if (age > 64 && age <= 122)
  71. {
  72. Console.WriteLine("10$");
  73. }
  74.  
  75. else
  76. {
  77. Console.WriteLine("Error!");
  78. }
  79. }
  80.  
  81. else
  82. {
  83. Console.WriteLine("Error!");
  84. }
  85. }
  86. }
  87. }
Runtime error #stdin #stdout #stderr 0.01s 134976KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Unhandled Exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: String
  at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x00006] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00014] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Int32.Parse (System.String s) [0x00007] in <8f2c484307284b51944a1a13a14c0266>:0 
  at Problem_6.Theatre_Promotions.Program.Main () [0x0000b] in <ba5f4c470d744d3083dd3cd6e6c0e723>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Value cannot be null.
Parameter name: String
  at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x00006] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00014] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Int32.Parse (System.String s) [0x00007] in <8f2c484307284b51944a1a13a14c0266>:0 
  at Problem_6.Theatre_Promotions.Program.Main () [0x0000b] in <ba5f4c470d744d3083dd3cd6e6c0e723>:0