Future value is the value today of money at a future point in time. For example take a $10 investment that would grow to $100 in five years. The future value of that $10 investment is $100. It is the value today of money tomorrow. It is calculated based on the amount of money, the amount of time (in years) into the future and a given monthly interest rate. Create a method with three parameters that computes future investment using the following formula: futureInvestmentValue =investmentAmount × (1 + monthlyInterestRate)numberOfYears*12 Use the following method header: public static double futureValue( double investmentAmount, double monthlyInterestRate, int years) For example, futureValue(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.80 2 1196.41 ... 29 13467.25 30 14730.57
public static double futureValue (double investmentAmount,
double monthlyInterestRate, int years)
{
x=investmentAmount*(1+monthlyInterestRate)^(years*12);
return x;
}
public static void printTable(double investmentAmount, double
monthlyInterestRate)
{
Cout<<"Enter Investment Amount";
Cin>>investmentAmount
Cout<<"Enter monthly interest rate";
Cin>>monthlyInterestRate;
cout<<"Years" & " " & "Future Value" &"\n";
for (int i=1; i<=30;i++)
{
x=futureValue(investmentAmount,monthlyInterestRate,i);
cout<<i & " " & x &"\n";
}
}
Get Answers For Free
Most questions answered within 1 hours.