Nephelir

Untitled

Jan 31st, 2020
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int days;
  10. cin >> days;
  11. cin.ignore();
  12. string roomType;
  13. getline(cin, roomType);
  14. string grade;
  15. cin >> grade;
  16.  
  17. int nights = days - 1;
  18. double allPrice = 0.0;
  19.  
  20. if (roomType == "room for one person")
  21. {
  22. if (days < 10 || days >= 10 && days <= 15 || days > 15)
  23. {
  24. allPrice = nights * 18.00;
  25. }
  26. }
  27. else if (roomType == "apartment")
  28. {
  29. allPrice = nights * 25.00;
  30.  
  31. if (days < 10)
  32. {
  33. allPrice = (nights * 25.00) - (allPrice * 0.30);
  34. }
  35. else if (days >= 10 && days <= 15)
  36. {
  37. allPrice = (nights * 25.00) - (allPrice * 0.35);
  38. }
  39. else if (days > 15)
  40. {
  41. allPrice = (nights * 25.00) - (allPrice * 0.50);
  42. }
  43. }
  44. else if (roomType == "president apartment")
  45. {
  46. allPrice = nights * 35.00;
  47.  
  48. if (days < 10)
  49. {
  50. allPrice = (nights * 35.00) - (allPrice * 0.10);
  51. }
  52. else if (days >= 10 && days <= 15)
  53. {
  54. allPrice = (nights * 35.00) - (allPrice * 0.15);
  55. }
  56. else if (days > 15)
  57. {
  58. allPrice = (nights * 35.00) - (allPrice * 0.20);
  59. }
  60. }
  61.  
  62. if (grade == "positive")
  63. {
  64. allPrice = allPrice + allPrice * 0.25;
  65. }
  66. else if (grade == "negative")
  67. {
  68. allPrice = allPrice - allPrice * 0.10;
  69. }
  70.  
  71. cout.setf(ios::fixed);
  72. cout.precision(2);
  73. cout << allPrice << endl;
  74.  
  75. return 0;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment