Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <cmath>
- using namespace std;
- int main()
- {
- int days;
- cin >> days;
- cin.ignore();
- string roomType;
- getline(cin, roomType);
- string grade;
- cin >> grade;
- int nights = days - 1;
- double allPrice = 0.0;
- if (roomType == "room for one person")
- {
- if (days < 10 || days >= 10 && days <= 15 || days > 15)
- {
- allPrice = nights * 18.00;
- }
- }
- else if (roomType == "apartment")
- {
- allPrice = nights * 25.00;
- if (days < 10)
- {
- allPrice = (nights * 25.00) - (allPrice * 0.30);
- }
- else if (days >= 10 && days <= 15)
- {
- allPrice = (nights * 25.00) - (allPrice * 0.35);
- }
- else if (days > 15)
- {
- allPrice = (nights * 25.00) - (allPrice * 0.50);
- }
- }
- else if (roomType == "president apartment")
- {
- allPrice = nights * 35.00;
- if (days < 10)
- {
- allPrice = (nights * 35.00) - (allPrice * 0.10);
- }
- else if (days >= 10 && days <= 15)
- {
- allPrice = (nights * 35.00) - (allPrice * 0.15);
- }
- else if (days > 15)
- {
- allPrice = (nights * 35.00) - (allPrice * 0.20);
- }
- }
- if (grade == "positive")
- {
- allPrice = allPrice + allPrice * 0.25;
- }
- else if (grade == "negative")
- {
- allPrice = allPrice - allPrice * 0.10;
- }
- cout.setf(ios::fixed);
- cout.precision(2);
- cout << allPrice << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment