//This is menu-driven program that makes a function call
//for each slection the user  makes.
#include <iostream>
#include <iomanip>
using namespace std;

//function protoype
void showMe();
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 double ADULT_CHOICE = 1,
				 CHILD_CHOICE = 2,
				 SENIOR_CHOICE = 3,
				 QUIT_CHOICE = 4;
	
	//constants for membership rates
	const double ADULT = 40.0,
				 SENIOR = 30.0,
				 CHILD = 20.0;
				 
	//Set up numeric output formatting.
	cout << fixed << showpoint << setprecision(2);
	
	do 
	{
		//display the menu and get the user 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;
		
		//dosplay the mebership fees.
		switch(choice)
		{
			case ADULT_CHOICE:
				 showFees(ADULT, months);
				 break;
			case CHILD_CHOICE:
				 showFees(CHILD, months);
				 break;
			case SENIOR_CHOICE:
				 showFees(SENIOR, months);
				 break;
		}
		}
	}
}
