Java Program To Calculate Future Investment Value

bookmark

import java.lang.*;
import java.util.Scanner;
class FIV
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
       
       System.out.print("Enter present value: ");
    double p=sc.nextInt();
     System.out.print("Enter the interest rate: ");
     double r=sc.nextInt();
    System.out.print("Enter the time period in years: ");
     double y=sc.nextInt();
    double f=p*Math.pow((1+r/100),y);
    System.out.print("value is: "+f);
  }
}

 


Output:
Enter present value: 1000
Enter the interest rate: 10
Enter the time period in years: 2
value is: 1210.0000000000002
 
Enter present value:
10000
Enter the interest rate: 1
Enter the time period in years:
10
value is: 11046.221254112046