I want to write a method that computes a future investment value after the user inputs the amount of the investment and the monthly interest rate after that, it will display the next 30 years of interest on the investment.

An example of the output after you put in the input,

The amount invested: 1000

Annual interest rate: 9%

Years Future Value

1 1093.80

2 1196.41

...

29 13467.25

30 14730.57

I'm almost positive that my math is off when it comes to this part

double Month = ((monthlyInterestRate / 12)); double YearlyInterest = investmentAmount * Month / (1 / Math.pow(1 + Month, i)); return (investmentAmount + YearlyInterest);

However, I could be wrong. Anyways, if you can help me with my math as I keep trying to figure out the formula but come up short. Thanks for your help!

import java.util.Scanner; public class Exercise05_07 { static Scanner input = new Scanner(System.in); public static void main(String[] args) { System.out.print("Enter investment amount: "); double investmentAmount = input.nextDouble(); System.out.print("Enter annual interest rate amount: "); double monthlyInterestRate = input.nextDouble(); System.out.println("The amount invested: " + investmentAmount); System.out.println("Annual interest rate: " + monthlyInterestRate + "%"); System.out.println("Years Future Value"); for (int i = 1; i < 31; i++) { System.out.println(i + " " + futureInvestmentValue( investmentAmount, monthlyInterestRate, i)); } } public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int i) { double Month = ((monthlyInterestRate / 12)); double YearlyInterest = investmentAmount * Month / (1 / Math.pow(1 + Month, i)); return (investmentAmount + YearlyInterest); } }