Java Programming Tutorial - Compound Interest Program



mport java.util.Scanner;
public class Coffee{
public static void main(String arg[]) { 
  double amount;
  double principal = 10000; 
  double rate = .01;
  
  for(int day=1; day<=20;day++) {
  amount = principal*Math.pow (1+rate, day);
  System.out.println(day + "  "+ amount);
    }
}
}
A = P(1+R)^n

Comments