+ 1
[Solved] Need help with the calculation. I keep tying different things but I can't seem to get it.
The program will calculate the membership fees over the next 10 years based on the membership level. The Gym charges a $1,200 per year, base fee but charges a percentage rate increase each year based on your membership rating: Gold Members 1% fee Silver Members 2% fee Bronze Members 4% fee https://code.sololearn.com/cc0YlL433hdS/?ref=app
7 Respostas
+ 1
Thank you
0
This statement
const double tax_rates = (.01, .02, .04 );
Assigns 0.4 to tax_rates always..
What are you trying here..
So this is like ex: input 2 then
cost += (cost * tax_rates) * user_input;
1200.00 + 1200.00*0.4*2
use an array for tax_rates;
use subscript notation as
cost += (cost * tax_rate[user_input]) ;
0
Thank you for your help but i can't use arrays or vectors.
As to what I am trying to do, is when i put 1 as the input it would represent for the gold level membership. The output would be
Year 1 $1200.00
Year 2 $1212.00
Year 3 $1224.12
Year 4 $1236.36
Year 5 $1248.72
Year 6 $1261.21
Year 7 $1273.82
Year 8 $1286.56
Year 9 $1299.43
Year 10 $1312.42
The same with silver if I press 2 but with the tax of being 2%, bronze if I press 3, tax is 4%, quit if pressed 4.
The calculation in some part isn't calculation how I want it too. I am next to this and don't know how to do it that well.
0
This is the modified code
https://code.sololearn.com/cwcMG8QJb2Yj/?ref=app
0
Your code has invalid characters. You may copied it from any net sourse so it can't run here.. Need to remove invalid characters or rewrite total code..
But looking at code, calculation for 1% is
cost += (cost * 0.1) *year; is wrong.
1% means 1/100 = 0.01 ; (0.1 is 10%) so
Just use
cost += (cost * 0.01) ;
Hope it works.. Check it out..
0
0
Ok. But there is no need 'time'. It's value is always 1, according to your instruction.
int time = (time = 0, time <= 9, ++time);
Check
cout << time ;