Question: PROBLEM 4: Write a program that asks the user to enter an interest rate and then uses a while loop to output the number of

PROBLEM 4: Write a program that asks the user to enter an interest rate and then uses a while loop to output the number of years it takes for the investment to double at that rate. The program should prompt the user whether or not they want to continue running the program. If the user types "yes", the program should repeat (i.e. ask for another interest rate and output the number of years it takes for the investment to double at that rate). The program should terminate once the user types "no" Note: the amount of the initial investment does not matter, because the percentage rate of grouth of the investment is the same regardless. You can use $1 as the initial investment. An example of input/output is shown below Determine how long it takes for an investment to double... Annual interest (8): 5 It takes 15 years for the investment to double Do you want to continue (yeso) ?yes Annual interest (8): 20 It takes 4 years for the investment to double. Do you want to continue (yeso) 2yes Annual interest (%): 10 It takes 8 years for the investment to double. Do you want to continue (yeso) ?no
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
