Write a function that computes future investment value at a given interest rate for a specified number of years.

Use the following function header:

```
double futureInvestmentValue(
double investmentAmount, double monthlyInterestRate, int years)
```
For example, futureInvestmentValue(10000, 0.05/12, 5) returns 12833.59.

Write a test program that prompts the user to enter the investment amount (e.g., 1000) and the interest rate (e.g., 9%), and prints a table that displays future value for the years from 1 to 30, as shown below:

```

The amount invested: 1000
Annual interest rate: 9
Years Future Value
1 1093.8
2 1196.41
...
29 13467.25
30 14730.57

```


```
#include
#include
using namespace std;

double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int numOfYears)
{
return investmentAmount * pow(1 + monthlyInterestRate, numOfYears * 12);
}

int main()
{
cout << "Enter yearly interest rate, for example 8.25: ";
double annualInterestRate;
cin >> annualInterestRate;

cout << "Enter loan amount, for example 120000.95: ";
double loanAmount;
cin >> loanAmount;

cout << "Years\tFuture Value" << endl;

for (int i = 1; i <= 30; i++)
{
double futureValue = futureInvestmentValue(loanAmount, annualInterestRate / 1200, i);
cout << "" << i << "\t" << (int)(futureValue * 100) / 100.0 << endl;
}

return 0;
}
```

Computer Science & Information Technology

You might also like to view...

In order to retain data while a program is not running, data must be saved in __________.

a. RAM b. a ListBox c. a control d. a file

Computer Science & Information Technology

What are the capabilities of the Intune desktop client?

What will be an ideal response?

Computer Science & Information Technology

When you use the method name with a child object, the parent's version of the method is used.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Which properties do all semiconductor memory cells share?

A .They exhibit two stable states which can be used to represent binary 1 and 0 B. They are not capable of being written into to set the state C. They are not capable of being read to sense the state D. All of the above

Computer Science & Information Technology