Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have errors in my c ++ code for the defining of my two of my program choices that I can't figure out. Please help.

I have errors in my c ++ code for the defining of my two of my program choices that I can't figure out. Please help.

#include #include using namespace std; // Function prototypes void showMenu(); void showFees(double, int); int main() { int choice; // To hold a menu choice int months; // To hold a number of months // Constants for the menu choices const int ADULT_CHOICE = 1, CHILD_CHOICE = 2, SENIOR_CHOICE = 3, DISABLEDVETERAN = 4, CLUBWORKER = 5, QUIT_CHOICE = 6; // Constants for membership rates const double ADULT = 40.0, SENIOR = 30.0, DISABLEDVETERAN = 1.0, CLUBWORKER = 5.0, CHILD = 20.0; // Set up numeric output formatting. cout << fixed << showpoint << setprecision(2); do { // Display the menu and get the user's choice. showMenu(); cin >> choice; // Validate the menu selection. while (choice < ADULT_CHOICE || choice > QUIT_CHOICE) { cout << "Please enter a valid menu choice: "; cin >> choice; } // If the user does not want to quit, proceed. if (choice != QUIT_CHOICE) { // Get the number of months. cout << "For how many months? "; cin >> months; // Display the membership fees. switch (choice) { case ADULT_CHOICE: showFees(ADULT, months); break; case CHILD_CHOICE: showFees(CHILD, months); break; case DISABLEDVETERAN_CHOICE: showFees(DISABLEDVETERAN, months); break; case CLUBWORKER_CHOICE: showFees(CLUBWORKER, months); break; case SENIOR_CHOICE: showFees(SENIOR, months); } } } while (choice != QUIT_CHOICE); return 0; } //***************************************************************** // Definition of function showMenu which displays the menu. * //***************************************************************** void showMenu() { cout << " \t\tHealth Club Membership Menu " << "1. Standard Adult Membership " << "2. Child Membership " << "3. Senior Citizen Membership " << "4. Disabled Veteran Membership " << "5. ClubWorkers " << "6. Quit the Program " << "Enter your choice: "; } //***************************************************************** // Definition of function showFees. The memberRate parameter * // the monthly membership rate and the months parameter holds the * // number of months. The function displays the total charges. * //***************************************************************** void showFees(double memberRate, int months) { cout << "The total charges are $" << (memberRate * months) << endl; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago