
This program will use two
functions. One will pass by reference and the other will pass by copy.
As a future investor, you need to calculate how your investments will produce income. You know from arithmetic class we can calculate future value. If an investment grows exponentially based on the compound interest formula…
A= p(1 + r/n)nt
A is the amount you will have after a certain amount of years.
p is the initial deposit.
r is the rate of interest you pay per year (APR).
n is the amount of times you compound per year.
t is the amount of years for the investment.
· In main ask name of the investment.
· Call a function, call it Get_data, that is a void function. You will ask 4 questions with cin’s.
1) amount of deposit (p) 2) rate of
investment (r) 3) time
periods/year (n) 4) time in years (t)
· This function will be proto-typed with the address operator (&) so it will have the aliases also addressed (&).
· Call a second function, call it Get_return, where you send in copies of the 4 variables. This function will have a return value of a double (this is the investment return amount).
SAMPLE
RUN…
Enter
name of investment: COCA-COLA
Enter
initial deposit: $28000.00
Enter
interest rate (APR): 0.095
Enter
time periods per year: 8
Enter
amount of time in years: 20
Return of investment: $185121.39
Enter
name of investment: Microsoft
Enter
initial deposit: $15000.00
Enter
interest rate (APR): 0.06
Enter
time periods per year: 4
Enter
amount of time in years: 12
Return of investment: $30652.17