Question: what is the output for this program in c++? #include #include #include #include using namespace std; // Function prototypes void displayMenu(); int getChoice(); void showFees(string
what is the output for this program in c++?
#include
// Function prototypes
void displayMenu(); int getChoice(); void showFees(string category,double rate,int months);
int main() { //Constants for monthly membership rates const double ADULT_RATE = 120.0, CHILD_RATE = 60.0, SENIOR_RATE = 100.0;
int choice, //Holds the user's menu choice months; //Number of months being paid //Set numeric output formatting cout< do { displayMenu(); choice = getChoice(); // Assign choice the value returned // by the getChoice function //If user does not want to quit, proceed if(choice != 4) { cout<<"For how many months? "; cin>> months; switch(choice) { case 1: showFees("Adult",ADULT_RATE,months); break; case 2: showFees("Child",CHILD_RATE,months); break; case 3: showFees("Senior",SENIOR_RATE,months); break; } } }while(choice != 4); return 0; } /***************************************************** * displayMenu * * This function clears the screen an then * * displays the menu choices * *****************************************************/ void displayMenu() { system("cls ||clear"); // clear the screen cout<< " Health Club Membership Menu "; cout<< " 1. Standard Adult Membership "; cout<< " 2. Child Membership "; cout<< " 3. Senior Citizen Membership "; cout<< " 4. Quit the Program "; } /******************************************************* * getChoice * * This function inputs, validates, and returns * * the user's menu choice * ********************************************************/ int getChoice() { int choice; cin>>choice; while(choice <1 || choice>4) { cout<<" the only valid choices are 1-4 , please re-enter ."; cin>>choice; } return choice; } void showFees(string memberType,double rate,int months) { cout< }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
