Trying to figure out how to put the discounts for
senior - 30%
membership for 12 or more months is- 15%
5or more training sessions is- 20%
How can I make this discounts work with my code to get the correct out put if a person picks 2 percentages exp. 1st(15%)&2nd(20%)I end up with 25% how can i get my program to run. Where can I add this discounts in my program PLEASE HELP!!! VERY NEW TO C++

 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465`` `````` #include #include 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"; 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')) if((twelveormore == 'Y')||(twelveormore == 'y')) if((training == 'Y')||(training == 'y')) price = price; return price; .``````
Last edited on
line 14: the value returned by ask is not stored anywhere so you are basically doing nothing with the value after the function runs.

line 59 to 61: since this is where you are checking for member status, this is where you will determine the rate of discount.

line 63: What are you doing with price?
Im really stuck but i will try to determine the rate in lines 59 to 61
Topic archived. No new replies allowed.