Advertisement
wigllytest

Untitled

Aug 3rd, 2020
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. string daysAsText, typeRoom, review;
  8.  
  9. getline(cin, daysAsText);
  10. getline(cin, typeRoom);
  11. getline(cin, review);
  12.  
  13. int days = stoi(daysAsText);
  14. double price = 0;
  15. int nights = days - 1;
  16.  
  17. if (typeRoom == "room for one person")
  18. {
  19. if (days < 10) price = nights * 18.00;
  20. else if (days >= 10 && days <= 15) price = nights * 18.00;
  21. else if (days > 15) price = nights * 18.00;
  22. }
  23.  
  24. else if (typeRoom == "apartment")
  25. {
  26. if (days < 10) price = nights * 25.00 * 0.7;
  27. else if (days >= 10 && days <= 15) price = nights * 25.00 * 0.65;
  28. else if (days > 15) price = nights * 25.00 * 0.5;
  29. }
  30.  
  31. else if (typeRoom == "president apartment")
  32. {
  33. if (days < 10) price = nights * 35.00 * 0.9;
  34. else if (days >= 10 && days <= 15) price = nights * 35.00 * 0.85;
  35. else if (days > 15) price = nights * 35.00 * 0.8;
  36. }
  37.  
  38. cout.setf(ios::fixed);
  39. cout.precision(2);
  40.  
  41. if (review == "positive") cout << price * 1.25;
  42. else if (review == "negative") cout << price * 0.9;
  43.  
  44.  
  45.  
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement