Nov 3, 2013 at 2:00am UTC
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++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
#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" ;
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 Nov 5, 2013 at 10:53pm UTC
Nov 3, 2013 at 11:53am UTC
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?
Nov 3, 2013 at 6:28pm UTC
Im really stuck but i will try to determine the rate in lines 59 to 61