Write a method that computes future investment value at a gi

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 futurelnvestmentValue C 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 below:

Solution

/**
* @author
*
*/
public class FinancialApplication {

   /**
   * @param Strings
   */
   public static void main(String[] Strings) {

       double futureInvestmentValue = futureInvestmentValue(10000, 0.05 / 12,
               5);

       System.out.print(\"Accumulated value is $\" + futureInvestmentValue);
   }

   /**
   * @param investmentAmount
   * @param monthlyInterestRate
   * @param years
   * @return
   */
   public static double futureInvestmentValue(double investmentAmount,
           double monthlyInterestRate, int years) {
       return investmentAmount
               * Math.pow((1 + monthlyInterestRate), (years * 12));
   }
}

OUTPUT:

Accumulated value is $12833.59

 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 fo

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site