- Assignment #5 – Value-returning functions
- Problem A): (50 points) If a principal amount P, for which the interest is compounded Q times per year, is placed in a savings account, then the amount of money in the account (the balance) after N years is given by the following formula, where I is the annual interest rate as a floating-point number:
- Balance = P x 1 + I N x Q
-  Q 
- Write an interactive C++ program that inputs the values for P, I, Q, and N and outputs the balance for each year up through year N. Use a value-returning function to compute the balance. This function must receive the principal P, the annual interest I, the number of times the interest is compounded per year Q, and the number of years N. Your program must keep asking the user to enter data for as long as he/she wants it (run my sample solution for a reference).
- The input of your program should look like the one below:
- Please enter the following data:
- Amount of principal (Ex. 5478.52) :$ 266.50 (P)
- Annual interest rate (Ex. 9.25):% 6.75 (I)
- Number of times interest is compounded per year (Ex. 10): 4 (Q)
- Number of years: 5 (N)
- Thank you
- The output of your program for an input as the above should look like the following:
- The balance after 1 years is: $ 284.95
- The balance after 2 years is: $ 304.68
- The balance after 3 years is: $ 325.77
- The balance after 4 years is: $ 348.32
- The balance after 5 years is: $ 372.43
- After showing the output, your program should ask the following questions and act accordingly to the answer.
- Enter 'f' or 'F' to finish, any other letter to continue:__ (the answer must be entered next to the prompt, not below)
- Note: do not need to round off the balance, just show it with 2 decimal digits.
- For clearing the screen use the statement shown below;
- system(“cls”);

5a

By: skylar | Date: Dec 6 2006 17:32 | Format: None | Expires: never | Size: 1.88 KB | Hits: 1229