Java Program to Calculate Simple Interest

In this post, we will learn how to calculate simple interest using Java Programming language. Let’s understand about Simple Interest and “how to calculate Simple Interest” so that we can code the Java Program to Calculate Simple Interest.

What is Simple Interest ?

Simple Interest is an easy and quick method to calculate interest on money. Simple Interest is calculated by multiplying the Principle amount by the rate of interest and the time period.

Simple Interest Formula

The Formula for simple interest is as follows:

SI = (P * R * T) / 100

where SI = Simple Interest
P = Principal Amount
R = Rate of Interest in Percentage
T = Time Period

Java Program to Calculate Simple Interest

import java.util.*;

public class Main{
    
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        
        System.out.println("Enter the Principle : ");
        double P = sc.nextDouble();
        
        System.out.println("Enter the Rate of Interest : ");
        double R = sc.nextDouble();
        
        System.out.println("Enter the Time Period : ");
        double T = sc.nextDouble();
        
        //Calculating the SI
        double SI = (P * R * T)/100;
        
        System.out.println("Simple Interest calculated is "+SI);
        
    }
    
}

Output

Enter the Principle : 12000
Enter the Rate of Interest : 5.5
Enter the Time Period : 10
Simple Interest calculated is 6600.0

How Does This Program Work ?

        Scanner sc = new Scanner(System.in);
        
        System.out.println("Enter the Principle : ");
        double P = sc.nextDouble();
        
        System.out.println("Enter the Rate of Interest : ");
        double R = sc.nextDouble();
        
        System.out.println("Enter the Time Period : ");
        double T = sc.nextDouble();

In this program, we first take the input of Principle, Rate of Interest, Time Period and stored them into variables P, R, T of double datatype respectively. The input is taken by using Scanner Class in Java.

        //Calculating the SI
        double SI = (P * R * T)/100;

Then, we calculate the Simple Interest using the formula discussed above.
i.e. SI = ( P * R * T ) / 100

        System.out.println("Simple Interest calculated is "+SI);

Then, we just display the Simple Interest result using the System.out.println() function. This is the Java Program to Calculate Simple Interest.

Read: Java Program to calculate Compound Interest

Conclusion

I hope after going through this post, you understand how to code Java Program to Calculate Simple Interest.
If you have any doubt regarding the topic, feel free to contact us in the Comment Section. We will be delighted to help you.

Also Read:

Leave a Comment

Your email address will not be published. Required fields are marked *