Investment Returns
Collapse Content
Show Content
You're writing a program to predict the return on different mutual funds. You start with $10,000 and are given the predicted annual appreciation and a fixed annual fee (as doubles
). Can you calculate the expected amount your money will be worth after 10 years? Keep track of the exact amount, but print the answer rounded to the nearest dollar.
For example, if given 0.08
and 200.0
, then after 1 year your money will be worth 10,000 * 1.08 - 200 = 10600
. Below is what your money will be worth after each year:
Year | Amount |
---|---|
0 | 10000 |
1 | 10600 |
2 | 11248 |
3 | 11948 |
4 | 12704 |
5 | 13520 |
6 | 14402 |
7 | 15354 |
8 | 16382 |
9 | 17493 |
10 | 18692 |
Print the final answer 18692
.
Challenge
Print the predicted sum of your investment after 10 years, rounded to the nearest dollar.
Please sign in or sign up to submit answers.
Alternatively, you can try out Learneroo before signing up.
Comments
thales
Jul 20, 6:21 AMa solution:
my code
Daniel Kozmacs
Apr 15, 9:09 AMDidn't know I'm able to use math.round, without it: my code.