+ 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

21st Jun 2022, 8:10 PM
Zero Silver
Zero Silver - avatar
7 odpowiedzi
+ 1
Thank you
22nd Jun 2022, 11:34 PM
Zero Silver
Zero Silver - avatar
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]) ;
21st Jun 2022, 8:34 PM
Jayakrishna 🇮🇳
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.
21st Jun 2022, 10:42 PM
Zero Silver
Zero Silver - avatar
22nd Jun 2022, 12:32 AM
Zero Silver
Zero Silver - avatar
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..
22nd Jun 2022, 9:41 AM
Jayakrishna 🇮🇳
24th Jun 2022, 1:58 AM
Zero Silver
Zero Silver - avatar
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 ;
24th Jun 2022, 9:05 AM
Jayakrishna 🇮🇳