Write a method that computes future investment value at a given interest rate – Java Program to Calculate Future Investment Value

Write a method that computes future investment value at a given interest rate: In the previous article, we have seen Java Program to Calculate Depreciation

In this article we will see how we can calculate future investment value java by using Java programming language.

Java Program to Calculate Future Investment Value

Before jumping to the program directly. Let’s know first what is this future investment value.

Future Investment Value:

Future investment value or future value represents the value of an investment at a given time in future. In general what is the rate of return of that investment after a certain period of investment. That investment may be direct monetary investment or asset investment or any indirect monetary investment.

Formula to find Future Value:

FV = PV * (1 + R)^T

Where,

  • FV represents Future Investment Value
  • PV represents Present Investment Value
  • R represents Rate of Return (Interest)
  • T represents Time Period (Number of Years)

Let’s see different ways to find future investment value.

Method-1: Java Program to Calculate Future Investment Value By Using Static Input Value

Approach:

  • Declare present value, time and rate of return.
  • Calculate future value using formula.
  • Print the result.

Program:

class Main
{
    public static void main(String args[])
    {
        //Present Investment Value
        double pv=50000;
        //Rate of Return
        double r=8;
        //Time Period in Number of Years
        double t=10;
   
        //calculating future value by using formula
        double fv=pv*Math.pow((1+r/100),t);
        System.out.print("Future Investment Value is: "+fv);
    }
}
Output:

Future Investment Value is: 107946.24986363942

Method-2: Java Program to Calculate Future Investment Value By Using User Input Value

Approach:

  • Take user input of present value, time and rate of return.
  • Calculate future value using formula.
  • Print the result.

Program:

import java.util.Scanner;
class Main
{
    public static void main(String args[])
    {
        //Scanner class object created
        Scanner sc = new Scanner(System.in);
        //taking user input of present value, time and rate of return
        System.out.print("Enter Present Investment Value: ");
        double pv=sc.nextInt();
        System.out.print("Enter the Rate of Return: ");
        double r=sc.nextInt();
        System.out.print("Enter the Time Period in Number of Years: ");
        double t=sc.nextInt();
        //calculating future value by using formula
        double fv=pv*Math.pow((1+r/100),t);
        System.out.print("Future Investment Value is: "+fv);
  }
}
Output:

Enter Present Investment Value: 10000
Enter the Rate of Return: 6
Enter the Time Period in Number of Years: 1
Future Investment Value is: 10600.0

Method-3: Java Program to Calculate Future Investment Value By Using User Defined Method

Approach:

  • Take user input of present value, time and rate of return.
  • Call a user defined method by passing present value, time and rate of return as parameter.
  • Inside method calculate future value using formula.
  • Print the result.

Program:

import java.util.Scanner;
class Main
{
    public static void main(String args[])
    {
        //Scanner class object created
        Scanner sc = new Scanner(System.in);
        //taking user input of present value, time and rate of return
        System.out.print("Enter Present Investment Value: ");
        double pv=sc.nextInt();
        System.out.print("Enter the Rate of Return: ");
        double r=sc.nextInt();
        System.out.print("Enter the Time Period in Number of Years: ");
        double t=sc.nextInt();
        //calling user defined method findFutureValue()
        findFutureValue(pv, r, t);
    }
    
    //findFutureValue() method to find future value
    public static void findFutureValue(double pv, double r, double t)
    {    
        //calculating future value by using formula
        double fv=pv*Math.pow((1+r/100),t);
        System.out.print("Future Investment Value is: "+fv);
    }
}
Output:

Enter Present Investment Value: 100000
Enter the Rate of Return: 4
Enter the Time Period in Number of Years: 5
Future Investment Value is: 121665.29024000002

Are you new to the java programming language? We recommend you to ace up your practice session with these Basic Java Programs Examples.

Practice these:

  1. Calculating Future Investment Value Java?
  2. Future Investment Value In Java?

Related Java Programs:

Leave a Comment