Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- #include<cmath>
- using namespace std;
- int main()
- {
- string month;
- double hoursStayed;
- double peopleNumber;
- string dayType;
- cin >> month;
- cin >> hoursStayed;
- cin >> peopleNumber;
- cin >> dayType;
- double priceForOnePerson = 0;
- if (month == "march")
- {
- if (dayType == "day")
- {
- priceForOnePerson = 10.50;
- }
- else if (dayType == "night")
- {
- priceForOnePerson = 8.4;
- }
- }
- else if (month == "april")
- {
- if (dayType == "day")
- {
- priceForOnePerson = 10.50;
- }
- else if (dayType == "night")
- {
- priceForOnePerson = 8.4;
- }
- }
- else if (month == "may")
- {
- if (dayType == "day")
- {
- priceForOnePerson = 10.50;
- }
- else if (dayType == "night")
- {
- priceForOnePerson = 8.4;
- }
- }
- else if (month == "june")
- {
- if (dayType == "day")
- {
- priceForOnePerson = 12.60;
- }
- else if (dayType == "night")
- {
- priceForOnePerson = 10.20;
- }
- }
- else if (month == "july")
- {
- if (dayType == "day")
- {
- priceForOnePerson = 12.60;
- }
- else if (dayType == "night")
- {
- priceForOnePerson = 10.20;
- }
- }
- else if (month == "august")
- {
- if (dayType == "day")
- {
- priceForOnePerson = 12.60;
- }
- else if (dayType == "night")
- {
- priceForOnePerson = 10.20;
- }
- }
- if (peopleNumber >= 4)
- {
- priceForOnePerson = priceForOnePerson * 0.1;
- }
- if (hoursStayed >= 5)
- {
- priceForOnePerson = priceForOnePerson * 0.5;
- }
- cout.setf(ios::fixed);
- cout.precision(2);
- double forTheHoleStay = priceForOnePerson * hoursStayed * peopleNumber;
- cout << "Price per person for one hour: " << priceForOnePerson << endl;
- cout << "Total cost of the visit: " << forTheHoleStay << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement