Source Code:
public class FutureInvestment {
public static void main(String[] args) {
double result = calculateFutureValue(1000, 5, 10);
System.out.println(result);
}
public static double calculateFutureValue(double investmentAmount, double monthlyInterestRate, int years) {
double rate = monthlyInterestRate / 100 / 12;
return investmentAmount * Math.pow(1 + rate, years * 12);
}
}
Output:
