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

The cost to become a member of a fitness center is as follows: (a) the senior ci

ID: 3679532 • Letter: T

Question

The cost to become a member of a fitness center is as follows: (a) the senior citizens discount is 30%; (b) if the membership is bought and paid for 12 or more months, the discount is 15%; (c) if more than five personal training sessions arc bought and paid for, the discount on each session is 20%. Write 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.)

Explanation / Answer

#include <iostream>
#include <iomanip>
using namespace std;
void display();
double ask(double& price);
int main()
{
double price;
display();
ask(price);
cout << "Price will be: " << price << endl;
return 0;
}
void display()
{
cout << " Fitness Menu "<< endl;;
cout << "_______________________________________"<< endl;
cout << "Price for joining is $30.00 " << endl;
cout << "Senior citizen discount is 30%" << endl;
cout << "If membership has paid for 12 or more months, 15% discount" << endl;
cout << "If more than 5 personal training sessions are paid for, 20% discount" << endl;
cout << "_______________________________________"<< endl;
return ;
}
double ask(double& price)
{
char senior;
char twelveormore;
char training;
// asks questions to user
price = 30.00;
cout << "Are you a senior citizen? " << endl;
cin >> senior;
if((senior == 'Y')||(senior == 'y')){
// even if the user hits somethign other than Y or y it still changes variable
cout <<"Senior discount applied "<<(price*.3)<<" Removed from cost" <<endl;
price=price-(price*.3);
}
cout << "Have you paid for more than 12 months?" << endl;
cin >> twelveormore;
if((twelveormore == 'Y')||(twelveormore == 'y'))
{
cout <<"12 month discount applied "<<(price*.15)<<" Removed from cost" <<endl;
price=price-(price*.15);
}
cout << "Have you received more than 5 personal training sessions? " << endl;
cin >> training;
if((training == 'Y')||(training == 'y')){
cout <<"Trainer discount applied "<<(price*.2)<<" Removed from cost" <<endl;
price=price-(price*.2);
}
return price;
}

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