Guest User

Hotel

a guest
Jan 27th, 2018
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04Problem_Hotel
  4. {
  5. class Hotel
  6. {
  7. static void Main(string[] args)
  8. {
  9. //Original code look here: https://pastebin.com/z6ETS7dZ
  10. //My correction look for "Add it by me" and "/"
  11. string month = Console.ReadLine();
  12.  
  13. int nightCount = int.Parse(Console.ReadLine());
  14.  
  15. decimal studioRoom = 0;
  16. decimal doubleRoom = 0;
  17. decimal suite = 0;
  18. decimal freeNight = 0;
  19.  
  20. if (month.Equals("May") || month.Equals("October"))
  21. {
  22. studioRoom += 50.0m;
  23. doubleRoom += 65.0m;
  24. suite += 75.0m;
  25.  
  26. if (nightCount > 7)
  27. {
  28. studioRoom -= (studioRoom * 0.05m);
  29. }
  30.  
  31. // Add it by me
  32. if (month.Equals("October") && nightCount>7)
  33. {
  34. studioRoom *= (nightCount - 1);
  35. }
  36. else
  37. {
  38. studioRoom *= nightCount;
  39. }
  40. //
  41. doubleRoom *= nightCount;
  42. suite *= nightCount;
  43. //if (month.Equals("October"))
  44. //{
  45. // freeNight = nightCount / 7;
  46. // studioRoom -= (freeNight * 47.5m);
  47. //}
  48.  
  49. }
  50. else if (month.Equals("June") || month.Equals("September"))
  51. {
  52. studioRoom += 60.0m;
  53. doubleRoom += 72.0m;
  54. suite += 82.0m;
  55.  
  56. if (nightCount > 14)
  57. {
  58. doubleRoom -= (doubleRoom * 0.10m);
  59. }
  60. //Add it by me
  61. if (month.Equals("September") && nightCount>7)
  62. {
  63. studioRoom *= (nightCount - 1);
  64. }
  65. else
  66. {
  67. studioRoom *= nightCount;
  68. }
  69. //
  70.  
  71. doubleRoom *= nightCount;
  72. suite *= nightCount;
  73.  
  74. //if (month.Equals("September"))
  75. //{
  76. // freeNight = nightCount / 7;
  77. // studioRoom -= (freeNight * 47.5m);
  78. //}
  79. }
  80. else if (month.Equals("July") || month.Equals("August") || month.Equals("December"))
  81. {
  82. studioRoom += 68.0m;
  83. doubleRoom +=77.0m;
  84. suite += 89.0m;
  85.  
  86. if (nightCount > 14)
  87. {
  88. suite -= (suite * 0.15m);
  89. }
  90.  
  91. studioRoom *= nightCount;
  92. doubleRoom *= nightCount;
  93. suite *= nightCount;
  94. }
  95.  
  96. Console.WriteLine("Studio: {0:f2} lv.", studioRoom);
  97. Console.WriteLine("Double: {0:f2} lv.", doubleRoom);
  98. Console.WriteLine("Suite: {0:f2} lv.", suite);
  99.  
  100. }
  101. }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment