Question: #include #include using namespace std; // This menu-driven Health Club membership program carries out the // appropriate actions based on the menu choice entered. A
#include #include using namespace std; // This menu-driven Health Club membership program carries out the // appropriate actions based on the menu choice entered. A do-while loop // allows the program to repeat until the user selects menu choice 4. int main() { // Constants for membership rates const double ADULT_RATE = 40.0; const double CHILD_RATE = 20.0; const double SENIOR_RATE = 30.0; int choice; // Menu choice int months; // Number of months double charges; // Monthly charges do { // Display the menu and get the user's choice cout << " Health Club Membership Menu "; cout << "1. Standard Adult Membership "; cout << "2. Child Membership "; cout << "3. Senior Citizen Membership "; cout << "4. Quit the Program "; cout << "Enter your choice: "; cin >> choice; // Validate the menu selection while ((choice < 1) || (choice > 4)) { cout << "Please enter 1, 2, 3, or 4: "; cin >> choice; } // Process the user's choice if (choice != 4) { cout << "For how many months? "; cin >> months; // Compute charges based on user input switch (choice) { case 1: charges = months * ADULT_RATE; break; case 2: charges = months * CHILD_RATE; break; case 3: charges = months * SENIOR_RATE; } // Display the monthly charges cout << fixed << showpoint << setprecision(2); cout << "The total charges are $" << charges << endl; } } while (choice != 4); // Loop again if the user did not // select choice 4 to quit system("pause"); return 0; } Download, run and analyze the program provided . Modify the downloaded program and add or modify the following modules: main() module which is calling the following functions having the prototypes: void menu(); void processChoice(int &ch); void dispMemCount(int cnt[]); Also include the following features: 1) Add family membership for $60 2) Counts of each type of membership type processed and display to the console at the end option (quit) Tip - use an array of counters. int memCount[4] = {0};
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
