Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- string daysAsText, typeRoom, review;
- getline(cin, daysAsText);
- getline(cin, typeRoom);
- getline(cin, review);
- int days = stoi(daysAsText);
- double price = 0;
- int nights = days - 1;
- if (typeRoom == "room for one person")
- {
- if (days < 10) price = nights * 18.00;
- else if (days >= 10 && days <= 15) price = nights * 18.00;
- else if (days > 15) price = nights * 18.00;
- }
- else if (typeRoom == "apartment")
- {
- if (days < 10) price = nights * 25.00 * 0.7;
- else if (days >= 10 && days <= 15) price = nights * 25.00 * 0.65;
- else if (days > 15) price = nights * 25.00 * 0.5;
- }
- else if (typeRoom == "president apartment")
- {
- if (days < 10) price = nights * 35.00 * 0.9;
- else if (days >= 10 && days <= 15) price = nights * 35.00 * 0.85;
- else if (days > 15) price = nights * 35.00 * 0.8;
- }
- cout.setf(ios::fixed);
- cout.precision(2);
- if (review == "positive") cout << price * 1.25;
- else if (review == "negative") cout << price * 0.9;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement