//this is amnu-driven program that makes a function call
// for each selection the user makes.
#include <iostream>
#include <iomanip>
using namespace std;

//function protottypes
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 membership rates
	const double ADULT = 40.0;
	const double SENIOR = 30.0;
	const double 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 < 1 || choice > 4)
		{
			cout << "Please enter 1, 2, 3, or 4: ";
			cin >> choice;
		}
		
		if (choice != 4)
		{
			//get the number months.
			cout << "For how many months? ";
			cin>> months;
			
			//display the membership fees.
			switch (choice)
			{
				case 1 : showFees(ADULT, months);
						 break;
				case 2 : showFees(CHILD, months);
						 break;
				case 3 : showFees(SENIOR, months);
			}
		}
	} while (choice != 4);
	return 0;
}

	//*****************************************************************
	// definition of function showMenu which displays the menu.		  *
	//*****************************************************************
	
	void showMenu()
	{
		cout << "\n\t\tHealth Club Membership Menu\n\n";
		cout << "1. Standard Adult Membership\n";
		cout << "2. Child Membership\n";
		cout << "3. Senior Citizen Membership\n";
		cout << "4. Quit the Program\n";
		cout << "Enter your choice: ";
	}
	
	//*****************************************************************
	// showFee stub													  *
	//*****************************************************************
	
	void showFees(double memberRate, int months)
	{
		cout << "The showFees function was called with "
			 << "the following arguments:\n"
			 << "memberRate: " << memberRate << endl
			 << "months: " << months << endl;
	}
