Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.0 kB
1
Indexable
#include <iostream>
#include<iomanip>
#include<string>

using namespace std;

int main()
{
	
	string daysInput, roomtype, rating;
	
	getline(cin, daysInput);
	getline(cin, roomtype);
	getline(cin, rating);

	int days = stoi(daysInput);
	int nitgh = days - 1;
	double pricenitgh = 0;

	if (roomtype == "room for one person") {
		pricenitgh = 18.00;
	}
	else if (roomtype == "president apartment") {
		pricenitgh = 35.00;
		if (days < 10) {
			pricenitgh *= 0.90;
		}
		else if (days <= 15) {
			pricenitgh *= 0.85;
		}
		else {
			pricenitgh *= 0.80;
		}
	}

	else if (roomtype == "apartment") {
		pricenitgh = 25.00;
		if (days < 10) {
			pricenitgh *= 0.70;
		}
		else if (days <= 15) {
			pricenitgh *= 0.65;
		}
		else {
			pricenitgh *= 0.50;
		}
	}

	double totalPrice = nitgh * pricenitgh;

	if (rating == "positive") {
		totalPrice += 0.25 * totalPrice;
	}
	else {
		totalPrice -= 0.10 * totalPrice;
	}
	cout << fixed << setprecision(2) << totalPrice << endl;

	return 0;

}
Leave a Comment