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
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Java Code Snippet - Calculate Compound Interest using Java Program
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