What is the formula to calculate the monthly compound interest rate using Java?
amount = principal * Math.pow(( 1 + rate / 100) , time); Seems only to give the annual rate not the compounded rate.
public static void main(String[] args) {
System.out.println("Welcome this program will use a basic financial formula that will caluculate monthly compound interest on a savings account.");
Scanner scanner = new Scanner(System.in);
double amount;//It will hold Compound Interest result
double principal; //It will hold the principal amount
double rate; // It will hold the rate
double time; // It will hold the time period
System.out.println("Enter Principal amount : ");
principal = scanner.nextDouble();
System.out.println("Enter the rate: ");
rate = scanner.nextDouble();
System.out.println("Enter the Time Period: ");
time = scanner.nextDouble();
//Compount Interest formula:
//amount = principal * (1 + rate / 100) ^ time
amount = principal * Math.pow((1 + rate / 100), time);
System.out.println("The Compound Interest is: " + amount);