Advertisement
kmer

Untitled

Nov 29th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 KB | None | 0 0
  1. using System;
  2.  
  3. namespace TravelAgency
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int x = 0;
  10. double price = 0;
  11. string town = Console.ReadLine();
  12. string pack = Console.ReadLine();
  13. string vip = Console.ReadLine();
  14. int days = int.Parse(Console.ReadLine());
  15. if (days > 7)
  16. {
  17. days -= 1;
  18. }
  19. if (town != "Bansko" && town != "Borovets" && town != "Varna"
  20. && town != "Burgas")
  21. {
  22. Console.WriteLine("Invalid input!");
  23. x = 0;
  24. } else
  25. {
  26. x = 1;
  27. }
  28.  
  29. if (x == 1)
  30. {
  31. if ((town == "Bansko" || town == "Borovets") &&
  32. pack != "withEquipment" && pack != "noEquipment")
  33. {
  34. Console.WriteLine("Invalid input!");
  35. x = 0;
  36. }
  37. else if ((town == "Varna" || town == "Burgas") &&
  38. pack != "withBreakfast" && pack != "noBreakfast")
  39. {
  40. Console.WriteLine("Invalid input!");
  41. x = 0;
  42. }
  43. else
  44. {
  45. x = 1;
  46. }
  47. }
  48. if (x == 1)
  49. {
  50. if (days < 1)
  51. {
  52. Console.WriteLine("Days must be positive number!");
  53. x = 0;
  54. }
  55. else
  56. {
  57. x = 1;
  58. }
  59. }
  60. if (x == 1)
  61. {
  62. if (town == "Bansko" || town == "Borovets")
  63. {
  64. if (pack == "withEquipment")
  65. {
  66. price = 100 * days;
  67. if (vip == "yes")
  68. {
  69. price *= 0.9;
  70. }
  71. }
  72. else if (pack == "noEquipment")
  73. {
  74. price = 80 * days;
  75. if (vip == "yes")
  76. {
  77. price *= 0.95;
  78. }
  79. }
  80. }
  81. else if (town == "Varna" || town == "Burgas")
  82. {
  83. if (pack == "withBreakfast")
  84. {
  85. price = 130 * days;
  86. if (vip == "yes")
  87. {
  88. price *= 0.88;
  89. }
  90. }
  91. else if (pack == "noBreakfast")
  92. {
  93. price = 100 * days;
  94. if (vip == "yes")
  95. {
  96. price *= 0.93;
  97. }
  98. }
  99. }
  100. }
  101.  
  102. if (x == 1)
  103. {
  104. Console.WriteLine("The price is " + $"{price:f2}" + "lv! Have a nice time!");
  105. }
  106. }
  107. }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement