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

35 -The cost to become a member of a fitness center is as follows: ( a) the seni

ID: 3568035 • Letter: 3

Question

35 -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%; and ( c) if more than five personal training sessions are 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.)

Need it program written in C++.

Explanation / Answer

Question

Question is 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%; and (c) if more than five personal training sessions are 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.)


And I have this so far


#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 /n";
cout << "_____________________________________________________________________ /n";
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 << "Price for joining is $30.00 " << endl;
cout << "_____________________________________________________________________ /n";

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;

cout << "Have you paid for more than 12 months?" << endl;

cin >> twelveormore;

cout << "Have you received more than 5 personal training sessions? " << endl;

cin >> training;

if((senior == 'Y')||(senior == 'y'))
// even if the user hits somethign other than Y or y it still changes variable

price = price - 1.03; // does this no matter what

return price;


}

answer

First:

It sounds like you have a break point inadvertently set that stops you execution at the first line. Maybe you can find a 'next step' or a similar instruction to bypass the break point. If you can find the breakpoint, you can jump from the break or restart.


Second: Your program seems to compile fine. When running the program, some formatting of the formatting seems a bit off due to being written as /n. Example:

$ ./membership

Fitness Menu /n______________________________________... /nSenior citizen discount is 30%
If membership has paid for 12 or more months, 15% discount
If more than 5 personal training sessions are paid for, 20% discount
Price for joining is $30.00
_______________________________________... /nAre you a senior citizen?
n
Have you paid for more than 12 months?
y
Have you received more than 5 personal training sessions?
n
Price will be: 30

You could change the slash N directions - for(ward)slash to backslash as seen here (where endl endings are optional):

void display()
{


cout << " Fitness Menu ";
cout << "______________________________________...
cout << "Senior citizen discount is 30% " ;
cout << "If membership has paid for 12 or more months, 15% discount ";
cout << "If more than 5 personal training sessions are paid for, 20% discount ";
cout << "Price for joining is $30.00 ";
cout << "_____________________________________ ";

return ;

}


Third - I'm guessing you want to finish the program on your own (calculations and such). Still, the price = price - 1.03 line confused me, so I suggest you change the following changed routine:


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;

cout << "Have you paid for more than 12 months?" << endl;

cin >> twelveormore;

cout << "Have you received more than 5 personal training sessions? " << endl;

cin >> training;

if((twelveormore == 'Y')||(twelveormore == 'y')) price *= .85; // 15% off
if((training == 'Y')||(training == 'y')) price *= .80; // 20% off
if((senior == 'Y')||(senior == 'y')) price *= .70; // 30% off


return price;

}

// I'M UNCLEAR: Was there a 20% discount per month over 5 months? If so, the number of months needs to be collected and a for loop like this is needed:

for(int = 0; i < NUM_OF_TRAININGS; i++) price *= 0.80 // %20 off

Forth: In your main, you're missing a $ sign in the cout statement:


int main()
{
double price;

display();
ask(price);
cout << "Price will be: $" << price << endl;
return 0;

}

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