Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

We are given the following code and must modify it. The following are the instru

ID: 3559094 • Letter: W

Question

We are given the following code and must modify it. The following are the instructions, and below the instructions is the code.

// 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.

#include <iostream>
#include <iomanip>
using namespace std;

// Constants for membership rates
const double ADULT_RATE = 40.0;
const double CHILD_RATE = 20.0;
const double SENIOR_RATE = 30.0;

void displayMenu();   
void verifyChoice(int &);
void processChoice(int &);

int main()
{
   int choice; // Menu choice
  
do
{
displayMenu();
   cin >> choice;
verifyChoice(choice);
   processChoice(choice);
      
} while (choice != 4); // Loop again if the user did not
system("pause"); // select choice 4 to quit
return 0;
}
void displayMenu(){
// 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: ";
}
void verifyChoice(int &choice)
{
// Validate the menu selection
   while ((choice < 1) || (choice > 4))
       {
       cout << "Please enter 1, 2, 3, or 4: ";
           cin >> choice;
       }
}
void processChoice(int &choice)
{
int months; // Number of months
double charges; // Monthly charges
// 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;
   }
}

Run and analyze the program provided as download. Modify the downloaded program and add the following features: Add family membership for $60 1120 points Add the code to write new membership accounts to the file "members.txt" 1120 points Add choice to view member accounts 1120 points Counts of each type of membership processed and display to the console at the end. Tip - use an array of counters. Documentation Running program What to submit? source code. members.txt. executable, screen capture as a zip file.

Explanation / Answer

// This menu-driven program uses a switch statement to carry out // the appropriate set of actions based on the menu choice entered. #include #include using namespace std; 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 // Display the menu and get the user's choice cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote