Problem 601. Retirement savings
At the start of what year will you have reached or exceeded a savings goal?
Parameters (all are constant scalars given in a structure):
- f.startingSalary: Starting yearly salary
- f.investRate: Percentage of salary invested each year
- f.raiseRate: Percentage raise given at beginning of year EXCEPT the first
- f.returnRate: Percentage gain in invested money
- f.goal: Savings goal
Simplifying assumptions:
- All money is invested at the end of the year.
- Interest is awarded once at the end of the year on money that has been invest for an entire year
- All interest is reinvested immediately and will gain interest the next year
Return:
- At the beginning of which year will the goal been met or exceeded?
Solution Stats
Problem Comments
-
2 Comments
Nikolaos Nikolaou
on 13 Oct 2020
Test suite is broken f.goal and maybe other field values remain the same as the first test case through the test suite
goc3
on 26 Oct 2020
Variables for the first test were implicitly defined with global scope (lacked initial %%). They should now be constrained to just the first test case.
Solution Comments
Show commentsProblem Recent Solvers28
Suggested Problems
-
1714 Solvers
-
Project Euler: Problem 8, Find largest product in a large string of numbers
1090 Solvers
-
Vectorize the digits of an Integer
317 Solvers
-
Set the array elements whose value is 13 to 0
1362 Solvers
-
509 Solvers
More from this Author51
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!