Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.36 KB | None | 0 0
  1. // Cornwall.cpp - This program computes hotel guest rates.
  2. // Input:  None
  3. // Output:  Hotel guest rate
  4.  
  5. #include <iostream>
  6. #include <string>
  7. using namespace std;
  8.  
  9. double computeRate(int);
  10. double computeRate(int, string);
  11.  
  12. int main()
  13. {
  14.    int days;
  15.    string mealPlan;
  16.    string question;
  17.    double rate = 0.0;  
  18.                
  19.    cout << "How many days do you plan to stay? " << endl;
  20.    cin >> days;
  21.    cout << "Do you want a meal plan? Y or N: " << endl;
  22.    cin >> question;
  23.     if(question == "Y"){
  24.         cout << "Enter meal plan code:";
  25.         cin >> mealPlan;
  26.         rate = computeRate(days, mealPlan);
  27.     }
  28.     else{
  29.        
  30.    
  31.  
  32.    // Figure out which arguments to pass to the computeRate() function and
  33.    // then call the computeRate() function                         
  34.    rate = computeRate(days);
  35.     }
  36.    cout << "The rate for your stay is $" << rate << endl;
  37.  
  38.    return 0;
  39. } // End of main() function
  40.    
  41.    
  42. // Write computeRate functions here.
  43. double computeRate(int days, string ans){
  44.     double price = 0;
  45.     if(ans == "A"){
  46.         price = days * 169.00;
  47.         cout << "Three meals are included per day" << endl;
  48.     }
  49.     else if(ans == "C"){
  50.         price = days * 112.00;
  51.         cout << "Breakfast is included each day." << endl;
  52.     }
  53. }
  54.  
  55. double computeRate(int days){
  56.     double price = 0;
  57.     price = days * 99.99;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement