In this Java example code we will calculate the simple interest with given principal, rate and time period values.
Simple Interest = (P × R × T) / 100
P — Principal amount
R — rate per annum
T — time in years
Java method to calculate simple interest with given p, r and t values.
1 2 3 4 |
public double getSimpleInterest(int p, double r, int t) { double simpleInterest = (p * r * t) / 100; return simpleInterest; } |