Question: Write a program invest.cpp which computes the value of an investment after a certain number of years at a certain interest rate. 1. Type emacs
Write a program invest.cpp which computes the value of an investment after a certain number of years at a certain interest rate. 1. Type emacs invest.cpp & (without the double quotes) at the terminal to create a new file, invest.cpp. 2. Prompt and read in the initial investment (type integer). 3. Prompt and read in the interest rate (type integer). 4. Prompt and read in the number of quarters (type integer). 5. Compute the final value of the investment compounded annually as: x * (1 + (R/100))Y where x is the initial investment, R is the interest rate, and Y is the number of years. Use the C++ function pow to compute (1 + (R/100))Y . Note that you will compute the investment value in years. Thus, you will need to convert the number of quarters to number of years. There are four quarters in a year. 6. Compute the profit from the investment as: profit = (final investment) (initial investment) 7. Output: Value of your investment compounded yearly after Y year(s) is D dollars. Profit from your investment after Y year(s) is P dollars. where Y is the number of years, D is the final value of the investment, and P is the profit 8. Compute the final value of the investment continuously compounded as: x * e (R/100)Y where e is Eulers number and equal to 2.71828. 9. Output: Value of your same investment but continuously compounded is D dollars. Profit from this investment is P dollars. The difference between both investment types is F dollars. where D is the final value of the investment, P is the profit, and F is the difference of the profits between both investment types.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
