Computer Science, asked by williamssiren686, 7 months ago

Write a program in java to input the principal, rate of interest and time in year. Find out compound interest. Compound interest=p* [1+r / 100)t – 1]

Answers

Answered by Anonymous
3

Answer:

public class JavaExample {

public void calculate(int p, int t, double r, int n) {

double amount = p * Math.pow(1 + (r / n), n * t);

double cinterest = amount - p;

System.out.println("Compound Interest after " + t + " years: "+cinterest);

System.out.println("Amount after " + t + " years: "+amount);

}

public static void main(String args[]) {

JavaExample obj = new JavaExample();

obj.calculate(2000, 5, .08, 12);

}

}

Similar questions