Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3. #include<cmath>
  4. using namespace std;
  5. int main()
  6. {
  7. string month;
  8. double hoursStayed;
  9. double peopleNumber;
  10. string dayType;
  11.  
  12. cin >> month;
  13. cin >> hoursStayed;
  14. cin >> peopleNumber;
  15. cin >> dayType;
  16.  
  17. double priceForOnePerson = 0;
  18.  
  19. if (month == "march")
  20. {
  21. if (dayType == "day")
  22. {
  23. priceForOnePerson = 10.50;
  24. }
  25. else if (dayType == "night")
  26. {
  27. priceForOnePerson = 8.4;
  28. }
  29. }
  30. else if (month == "april")
  31. {
  32. if (dayType == "day")
  33. {
  34. priceForOnePerson = 10.50;
  35. }
  36. else if (dayType == "night")
  37. {
  38. priceForOnePerson = 8.4;
  39. }
  40. }
  41. else if (month == "may")
  42. {
  43. if (dayType == "day")
  44. {
  45. priceForOnePerson = 10.50;
  46. }
  47. else if (dayType == "night")
  48. {
  49. priceForOnePerson = 8.4;
  50. }
  51. }
  52. else if (month == "june")
  53. {
  54. if (dayType == "day")
  55. {
  56. priceForOnePerson = 12.60;
  57. }
  58. else if (dayType == "night")
  59. {
  60. priceForOnePerson = 10.20;
  61. }
  62. }
  63. else if (month == "july")
  64. {
  65. if (dayType == "day")
  66. {
  67. priceForOnePerson = 12.60;
  68. }
  69. else if (dayType == "night")
  70. {
  71. priceForOnePerson = 10.20;
  72. }
  73. }
  74. else if (month == "august")
  75. {
  76. if (dayType == "day")
  77. {
  78. priceForOnePerson = 12.60;
  79. }
  80. else if (dayType == "night")
  81. {
  82. priceForOnePerson = 10.20;
  83. }
  84. }
  85.  
  86. if (peopleNumber >= 4)
  87. {
  88. priceForOnePerson = priceForOnePerson * 0.1;
  89. }
  90.  
  91. if (hoursStayed >= 5)
  92. {
  93. priceForOnePerson = priceForOnePerson * 0.5;
  94. }
  95.  
  96.  
  97. cout.setf(ios::fixed);
  98. cout.precision(2);
  99. double forTheHoleStay = priceForOnePerson * hoursStayed * peopleNumber;
  100.  
  101.  
  102.  
  103. cout << "Price per person for one hour: " << priceForOnePerson << endl;
  104. cout << "Total cost of the visit: " << forTheHoleStay << endl;
  105.  
  106.  
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement