SvilenVelikov

Untitled

Sep 25th, 2017
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 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 Hotel
  10. {
  11. static void Main(string[] args)
  12. {
  13. string month = Console.ReadLine();
  14. int nightCount = int.Parse(Console.ReadLine());
  15. double priceStudio = 0.0, priceDoubleRoom = 0.0, priceSuite = 0.0;
  16. double discountStudioMayOctober = 0.0, discountDouble = 0.0,
  17. discountSuite = 0.0;
  18. double priceTotalStudio = 0, priceTotalDoubleRoom = 0, priceTotalSuite = 0;
  19.  
  20. switch (month)
  21. {
  22. case "May":
  23. case "October":
  24. priceStudio = 50.0;
  25. priceDoubleRoom = 65.0;
  26. priceSuite = 75.0;
  27. if (nightCount > 7)
  28. {
  29. discountStudioMayOctober = 0.05;
  30. }
  31. break;
  32.  
  33. case "June":
  34. case "September":
  35. priceStudio = 60.0;
  36. priceDoubleRoom = 72.0;
  37. priceSuite = 82.0;
  38. if (nightCount > 14)
  39. {
  40. discountDouble = 0.10;
  41. }
  42. break;
  43.  
  44.  
  45. case "July":
  46. case "August":
  47. case "December":
  48. priceStudio = 68.0;
  49. priceDoubleRoom = 77.0;
  50. priceSuite = 89.0;
  51. if (nightCount > 14)
  52. {
  53. discountSuite = 0.15;
  54. }
  55. break;
  56. }
  57.  
  58. priceTotalStudio = priceStudio * nightCount * (1 - discountStudioMayOctober);
  59. if ((month == "September" || month == "October") && (nightCount > 7)) //one night free
  60. {
  61. priceTotalStudio = priceTotalStudio - 1 * priceStudio;
  62. }
  63.  
  64. priceTotalDoubleRoom = priceDoubleRoom * nightCount * (1 - discountDouble);
  65. priceTotalSuite = priceSuite * nightCount * (1 - discountSuite);
  66.  
  67. Console.WriteLine($"Studio: {priceTotalStudio:f2} lv.");
  68. Console.WriteLine($"Double: {priceTotalDoubleRoom:F2} lv.");
  69. Console.WriteLine($"Suite: {priceTotalSuite:F2} lv.");
  70.  
  71.  
  72. }
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment