Showing posts with label Calculator. Show all posts
Showing posts with label Calculator. Show all posts

Thursday, January 19, 2017

How to Calculate the Future Investment Value of Investment.

Below java program for calculate future investment value.
Here calculate s using the formula futureInvestmentValue =investmentAmount x (1 + monthlyInterestRate)^numberOfYears*12.

Output: 





Java code here.

package swain.swain;

import java.util.Scanner;

public class CalculateFutureInvestmentValue {
    public static void main(String[] args) {

         Scanner input = new Scanner(System.in);

         System.out.println("Enter investment amount:");
         double investmentAmount = input.nextDouble();
         System.out.println("Enter annual interest rate in percentage:");
         double monthlyInterestRate = input.nextDouble();
         System.out.println("Enter number of years:");
         double numberOfYears = input.nextDouble();
         double futureInvestmentValue = investmentAmount * Math.pow((1 + (monthlyInterestRate / 1200)), (numberOfYears * 12));
         futureInvestmentValue = (int) (futureInvestmentValue * 100) / 100.0;
         System.out.println("Accumulated value is " + futureInvestmentValue + "\n");
    }
}


How ChatGPT can Benefit Coding: Your Guide to Leveraging an AI Language Model

 Introduction: Hello, coders! Welcome to this blog post on how ChatGPT, an AI language model, can benefit your coding skills and projects. A...