Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

The cost to become a member of a fitness center is as follows:

The cost to become a member of a fitness center is as follows:

  • The senior citizens discount is 30%
  • If the membership is bought and paid for 12 or more months, the discount is 15%
  • If more than five personal training sessions are bought and paid for, the discount on each session is 20%.

I need a menu-driven program that determines the cost of a new membership. Your program must contain a function that displays the general information about the fitness center and its charges, a function to get all of the necessary information to determine the membership cost, and a function to determine the membership cost. Use appropriate parameters to pass information in and out of a function. (Do not use any global variables.)

So Far I have:

//Header files

#include <iostream>

using namespace std;

//function prototypes

void displayInfo();

int readData();

int memCost(int, int, int);

//function main

int main()

{

int cost;

displayInfo();

cost = readData();

cout<<"nThe cost of the membership is : $"<<cost<<endl;

system("pause");

}//end main

//function to display information

void displayInfo()

{

cout<<"ntFitness Center - General informationn"<<

cout<<"Membership for month: $200n";

cout<<"Membership for personal training: $100n";

cout<<"Discount for Senior citizens: 30%n";

cout<<"Discount on purchasing 12 or more months: 15%n";

cout<<"Discount on purchasing 5 or more personal training: 20%nn";

}//end display

//function to read data

int readData()

{

int srCitizen, proChoice,months=0,sessions=0,cost;

cout<<"Enter your purchase details...n";

cout<<"Enter 1 if you are senior citizen or 0 if not : ";

cin>>srCitizen;

if(srCitizen != 1)

srCitizen =0;

cout<<"nChoose your fitness program...n";

cout<<"1. Monthly membershipn";

cout<<"2. Personal Trainingn";

cout<<"nEnter your choice : ";

do

{

cin>>proChoice;

if(proChoice<1||proChoice>2)

cout<<"Enter a valid choice : ";

}while(proChoice<1||proChoice>2);

if(proChoice==1)

{

cout<<"Enter number of months you want : ";

cin>>months;

}

if(proChoice==2)

{

cout<<"Enter number of sessions you want : ";

cin>>sessions;

}

cost = memCost(srCitizen,months,sessions);

return cost;

}//end read data

//function to calculate membership

int memCost(int sr, int m, int s)

{

int cost;

//calculation if personal training is purchased

if(m==0)

{

if(s<5)

cost = s*100;

else

cost = s*100*0.8;

}

//calculation if monthly is purchased

if(s==0)

{

if(m<12)

cost = m*200;

else

cost = s*100*0.85;

}

//giving discount to senior citizens

if(sr==1)

cost=cost*0.7;

return cost;

}//end function calculate

What am I doing wrong? help is greatly appreciated

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question