Write a method that computes future investment value at a gi
Solution
FutureInvestment.java
import java.util.Scanner;
public class FutureInvestment {
public static void main(String[] args) {
//Declaring variables
double investment_amount,interest_rate,futInvestmentValue;
//Scanner class object is used to read the inputs entered by the user
Scanner sc=new Scanner(System.in);
//Getting the invest amount entered by the user
System.out.print(\"Enter Investment amount :\");
investment_amount=sc.nextDouble();
//Getting the interest rate entered by the user
System.out.print(\"Enter Interest Rate :\");
interest_rate=sc.nextDouble();
//Displaying every year investment value
System.out.println(\"Years\\tFuture Value\");
for(int i=1;i<=30;i++)
{
//calculating the investment value for every year
futInvestmentValue = (investment_amount )* Math.pow(1 + (interest_rate/1200),i*12);
//Displaying the investment value
System.out.printf(\"%d\\t%.2f\",i,futInvestmentValue);
System.out.println(\" \");
}
}
}
__________________________________
Output:
Enter Investment amount :1000
Enter Interest Rate :9
Years Future Value
1 1093.81
2 1196.41
3 1308.65
4 1431.41
5 1565.68
6 1712.55
7 1873.20
8 2048.92
9 2241.12
10 2451.36
11 2681.31
12 2932.84
13 3207.96
14 3508.89
15 3838.04
16 4198.08
17 4591.89
18 5022.64
19 5493.80
20 6009.15
21 6572.85
22 7189.43
23 7863.85
24 8601.53
25 9408.41
26 10290.99
27 11256.35
28 12312.28
29 13467.25
30 14730.58
_____________________Thank You

