Q:

Java - Calculate Compound Interest using Java Program.

0

Java - Calculate Compound Interest using Java Program.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Java Code Snippet - Calculate Compound Interest using Java Program

import java.util.Scanner;
 
public class Compound_Interest {
 
    /**
     * @param args
     */
    public static void main(String[] args) {
 
        double Principal_Amount = 0.0;
        double Interest_Rate = 0.0;
        double Time_Period = 0.0;
        double CompoundInterest = 0.0;
 
        Scanner i = new Scanner(System.in);
 
        System.out.print("Enter the Principal Amount : "); 
        Principal_Amount = i.nextDouble();
 
        System.out.print("Enter the Time Period : "); 
        Time_Period = i.nextDouble();
 
        System.out.print("Enter the Interest Rate : "); 
        Interest_Rate = i.nextDouble();
 
        CompoundInterest = Principal_Amount * Math.pow((1 + Interest_Rate/100),Time_Period); 
 
        System.out.println("");
        System.out.println("Compound Interest : "+CompoundInterest);       
    }
 
}

Output

    Enter the Principal Amount : 100000
    Enter the Time Period : 5
    Enter the Interest Rate : 9.5

    Compound Interest : 157423.87409343748

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now