Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Cornwall.cpp - This program computes hotel guest rates.
- // Input: None
- // Output: Hotel guest rate
- #include <iostream>
- #include <string>
- using namespace std;
- double computeRate(int);
- double computeRate(int, string);
- int main()
- {
- int days;
- string mealPlan;
- string question;
- double rate = 0.0;
- cout << "How many days do you plan to stay? " << endl;
- cin >> days;
- cout << "Do you want a meal plan? Y or N: " << endl;
- cin >> question;
- if(question == "Y"){
- cout << "Enter meal plan code:";
- cin >> mealPlan;
- rate = computeRate(days, mealPlan);
- }
- else{
- // Figure out which arguments to pass to the computeRate() function and
- // then call the computeRate() function
- rate = computeRate(days);
- }
- cout << "The rate for your stay is $" << rate << endl;
- return 0;
- } // End of main() function
- // Write computeRate functions here.
- double computeRate(int days, string ans){
- double price = 0;
- if(ans == "A"){
- price = days * 169.00;
- cout << "Three meals are included per day" << endl;
- }
- else if(ans == "C"){
- price = days * 112.00;
- cout << "Breakfast is included each day." << endl;
- }
- }
- double computeRate(int days){
- double price = 0;
- price = days * 99.99;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement