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

Need help on how to modify this program based on the problem given: When computi

ID: 3652929 • Letter: N

Question

Need help on how to modify this program based on the problem given:

When computing the membership cost, first determine cost based upon months of membership bought and paid for. Then, apply the senior discount against that cost. For instance, if the montly cost is $100 and someone pays for 12 months, the cost at that point is $1020. If they are a senior, then take 30% off of $1020. Therefore, the cost at that point is now $714. Then, if personal training sessions cost $25 and they happen to buy 4, the total cost of membership is $814.00


Here's my code:


#include <cstdlib>

#include <iostream>


using namespace std;


void displayMenu();

char readInfo();

void discount(char);


int main(int argc, char *argv[])

{

displayMenu();

char ch = readInfo();

discount(ch);

system("PAUSE");

return EXIT_SUCCESS;

}


void displayMenu()

{

cout << "Discount Menu" << endl;

cout << "----------------------------------------------" << endl;

cout << "(a) Senior Citizens is 30%" << endl;

cout << "(b) Membership for 12 or more months is 15%" << endl;

cout << "(c) More than five personal training" << " sessions is 20%" << endl;

}


char readInfo()

{

char choice;

cout << "Enter your choice " << endl;

cin >> choice;

return choice;

}


void discount (char ch)

{

int amt;

do

{

cout << "Enter amount" << endl;

cin >> amt;

} while (amt < 0);

switch (ch)

{

case 'a' : cout << "your discount value" << amt * 0.3; break;

case 'b' : cout << "your discount value" << amt * 0.15; break;

case 'c' : cout << "your discount value" << amt * 0.2; break;

}

}

Explanation / Answer

This should work fine #include using namespace std; void displayMenu(); char readInfo(); void discount(char); int main(int argc, char *argv[]) { displayMenu(); char ch = readInfo(); discount(ch); system("PAUSE"); return EXIT_SUCCESS; } void displayMenu() { cout
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