Simple Interest is calculated using the Principal Amount, Rate of Interest per year and duration in years. Java Simple Interest Calculation Program is another simple and easy program to learn the basics of java programming. It is a sequential set of statements without any conditional or looping statements.
The program given as an example here reads the principal Amount, the rate of interest and the duration to calculate simple interest. It returns the amount of interest with the following formula.
Simple Interest Amount = Principal Amount * Rate of Interest (per year)* Duration in years/100
Java Simple Interest Calculation
Let’s see how the above formula is implemented in java program to find the Simple Interest Amount for the given values.
import java.util.Scanner; public class SimpleInterest { public static void main(String[] args) { Scanner scObj= new Scanner(System.in); //Read Principal Amount from user System.out.println("Principal Amount"); int intPrinAmt = scObj.nextInt(); //Read Rate of Interest from user System.out.println("Rate of Interest"); float intRateInterest = scObj.nextFloat(); //Read Rate of Duration from user System.out.println("Simple Interest Duration"); int intDuration = scObj.nextInt(); //Calculate Simple Interest float SimpleInterest= intPrinAmt*intRateInterest*intDuration/100; System.out.println("The simple interest is =" +SimpleInterest); } }