This Java program calculates the future value of an investment based on the investment amount, rate of interest, and number of years using the formula FV = PV * (1 + r)^n, where FV is the future value, PV is the present value (investment amount), r is the monthly interest rate, and n is the number of months. Here's how the program works:
import java.util.Scanner; public class Future_Investmen { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter the Investment Amount : "); double inves = in.nextDouble(); System.out.print("Enter the Rate of Interest : "); double rate = in.nextDouble(); System.out.print("Enter Number of Years: "); int year = in.nextInt(); rate *= 0.01; System.out.println("\nYears FutureValue"); System.out.println("-----------------------"); for(int i = 1; i <= year; i++) { int format = 19; if (i >= 10) format = 18; System.out.printf(i + "%"+format+".2f\n", future_Value(inves, rate/12, i)); } } public static double future_Value(double inves_amt, double mon_inv_rate, int years) { return inves_amt * Math.pow(1 + mon_inv_rate, years * 12); } }
Enter the Investment Amount : 8500 Enter the Rate of Interest : 56 Enter Number of Years: 6 Years FutureValue ----------------------- 1 14693.31 2 25399.22 3 43905.72 4 75896.51 5 131196.58 6 226789.66
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions