Advertisement
viraco4a

MyHotel

May 16th, 2018
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 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 Hotel
  8. {
  9. class Program
  10. {
  11. static void Main()
  12. {
  13. string Month = Console.ReadLine();
  14. int NightCounts = int.Parse(Console.ReadLine());
  15. double Studio = GetStudioPrices(Month, NightCounts);
  16. double Double = GetDoublePrices(Month, NightCounts);
  17. double Suite = GetSuitePrices(Month, NightCounts);
  18. double TotalStudio = 0;
  19. if ((Month == "September" || Month == "October") && (NightCounts > 7))
  20. {
  21. TotalStudio = Studio * (NightCounts - 1);
  22. }
  23. else
  24. {
  25. TotalStudio = Studio * NightCounts;
  26. }
  27. double TotalDouble = Double * NightCounts;
  28. double TotalSuite = Suite * NightCounts;
  29.  
  30. Console.WriteLine($"Studio: {TotalStudio:f2} lv.");
  31. Console.WriteLine($"Double: {TotalDouble:f2} lv.");
  32. Console.WriteLine($"Suite: {TotalSuite:f2} lv.");
  33.  
  34. }
  35.  
  36. private static double GetSuitePrices(string Month, int NightCounts)
  37. {
  38. double Suite = 0;
  39. if (Month == "May" || Month == "October")
  40. {
  41. Suite = 75;
  42. }
  43. else if (Month == "June" || Month == "September")
  44. {
  45. Suite = 82;
  46. }
  47. else
  48. {
  49. Suite = 89;
  50. if (NightCounts > 14)
  51. {
  52. Suite = 89 * (1 - 0.15);
  53. }
  54. }
  55.  
  56. return Suite;
  57. }
  58.  
  59. private static double GetDoublePrices(string Month, int NightCounts)
  60. {
  61. double Double = 0;
  62. if (Month == "May" || Month == "October")
  63. {
  64. Double = 65;
  65. }
  66. else if (Month == "June" || Month == "September")
  67. {
  68. Double = 72;
  69. if (NightCounts > 14)
  70. {
  71. Double = 72 * (1 - 0.1);
  72. }
  73. }
  74. else
  75. {
  76. Double = 77;
  77. }
  78.  
  79. return Double;
  80. }
  81.  
  82. private static double GetStudioPrices(string Month, int NightCounts)
  83. {
  84. double Studio = 0;
  85. if (Month == "May" || Month == "October")
  86. {
  87. Studio = 50;
  88. if (NightCounts > 7)
  89. {
  90. Studio = 50 * (1 - 0.05);
  91. }
  92. }
  93. else if (Month == "June" || Month == "September")
  94. {
  95. Studio = 60;
  96. }
  97. else
  98. {
  99. Studio = 68;
  100. }
  101.  
  102. return Studio;
  103. }
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement