Advertisement
Guest User

03. Vacation

a guest
Feb 20th, 2020
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _03._Vacation
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int numOfPeople = int.Parse(Console.ReadLine());
  10. string typeOfGroup = Console.ReadLine().ToLower();
  11. string dayOfWeek = Console.ReadLine().ToLower();
  12.  
  13. decimal price = 0;
  14.  
  15. if (typeOfGroup == "students")
  16. {
  17. switch (dayOfWeek)
  18. {
  19. case "friday":
  20. price = 8.45M;
  21. break;
  22. case "saturday":
  23. price = 9.8M;
  24. break;
  25. case "sunday":
  26. price = 10.46M;
  27. break;
  28. }
  29. if (numOfPeople >= 30)
  30. {
  31. price *= 0.85M;
  32. }
  33. }
  34. else if (typeOfGroup == "business")
  35. {
  36. switch (dayOfWeek)
  37. {
  38. case "friday":
  39. price = 10.9M;
  40. break;
  41. case "saturday":
  42. price = 15.6M;
  43. break;
  44. case "sunday":
  45. price = 16;
  46. break;
  47. }
  48. if (numOfPeople >= 100)
  49. {
  50. price *= 0.9M;
  51. }
  52. }
  53. else if (typeOfGroup == "regular")
  54. {
  55. switch (dayOfWeek)
  56. {
  57. case "friday":
  58. price = 15;
  59. break;
  60. case "saturday":
  61. price = 20;
  62. break;
  63. case "sunday":
  64. price = 22.5M;
  65. break;
  66. }
  67. if (numOfPeople >= 10 && numOfPeople <= 20)
  68. {
  69. price *= 0.95M;
  70. }
  71. }
  72.  
  73. decimal totalPrice = numOfPeople * price;
  74.  
  75. Console.WriteLine($"Total price: {totalPrice:f2}");
  76. }
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement