You have saved $150,000 in the bank. You decide to invest this money in the stock market. The average rate of return to expect from the stock market is around 8% per year.
Under these conditions (assuming a constant return each year), how many years will it take your money to grow to $1M?
Answer in terms of full years (i.e. round up to the nearest full year, as necessary).
Log the original balance, the number of years, and the actual ending balance to the console.
Use the provided formatUSD function to format the currency values.
HINT: use a while loop and some basic math (shouldn't need any fancy financial formulae).
See the prompt from Part 1, where we are determining how long it will take an investment to reach $1M.
Repeat the analysis, except instead of assuming a constant 8% return per year, this time use a simulated random return instead.
To simulate the return, use a normal distribution with mean of 8% and standard deviation of 15%.
HINT: see the d3.randomNormal() function provided by the d3-random library.
In addition to logging the original balance, the number of years, and the actual ending balance to the console, the program should also log the specific random return rates used each year.
Create your own HTML interface that will allow the user to run their own simulation as described in Part 2. The interface should allow the user to input values for the initial balance, desired ending balance, mean, and standard deviation. The interface should include a button, that when clicked should perform the simulation and and display the resulting number of years and actual ending balance on the page.