Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include <iostream>
- using namespace std;
- int main()
- {
- string months[] = { "january", "february", "march", "april", "may", "june",
- "july", "august", "september", "october", "november", "december" };
- string month;
- int hours;
- int persons;
- double price;
- double pricePerPerson;
- double totalPrice;
- double regularPrice;
- string dayTime[] = { "day","night" };
- string time;
- cin >> month >> hours >> persons >> time;
- if(month == months[2] || month == months[3] || month == months[4]){
- if(time == dayTime[0]){
- price = 10.50;
- }else{
- price = 8.4;
- }
- }
- else if(month == months[5] || month == months[6] || month == months[7]){
- if(time == dayTime[0]){
- price = 12.60;
- }else{
- price = 10.20;
- }
- }
- regularPrice = price * hours;
- pricePerPerson = regularPrice / (double)persons;
- if(persons >= 4){
- pricePerPerson = pricePerPerson - (pricePerPerson * 0.1);
- }
- if(hours >= 5){
- pricePerPerson = pricePerPerson - (pricePerPerson * 0.5);
- }
- totalPrice = pricePerPerson * hours * persons;
- cout.setf(ios::fixed);
- cout.precision(2);
- cout << "Price per person for one hour: " << pricePerPerson <<endl;
- cout.setf(ios::fixed);
- cout.precision(2);
- cout << "Total cost of the visit: "<< totalPrice<<endl;
- /*for(int i =0; i<12 ; i++){
- cout << months[i] << endl;
- }
- */
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement