Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a method that computes future investment value at a given interest rate fo

ID: 3924378 • Letter: W

Question

Write a method that computes future investment value at a given interest rate for a specified number of years. The future investment is determined using the formula in Programming Exercise 2.21. Use the following method header: public static double futurelnvestmentValueC double investmentAmount, double monthlylnterestRate, 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:

Explanation / Answer

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 Future 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 %.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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote