Simple Interest Program in Java
Hello guys, hope you are having a great day. Today we will see how to calculate Simple Interest in Java.
The program remains the same as that of compound interest, only the formula changes.
Simple Interest
The interest earned on a particular sum for a certain period of time is known as Simple Interest.
In simple interest, interest is earned only on the initial sum and not the amount after certain periods.
Formula:
Simple Interest= (Principle* Rate * Time)/100
Amount= Principle + Simple Interest
In our program, we are taking input from the user in floating point.
The interest earned on Compound Interest is more than the interest earned on Simple Interest. This is because Simple Interest is applied to a particular sum for the whole period whereas compound interest is applied to incremented sum after a new deposit.
Program to find the simple interest in Java
Okay now, let us straight go to the code:
import java.util.*; public class test { public static void main(String args[]) { double principle,rate,time; Scanner sc = new Scanner(System.in); System.out.println("Enter Priciple,Rate and Time "); principle=sc.nextDouble(); rate=sc.nextDouble(); time=sc.nextDouble(); double SimpleInterest = (principle*rate*time)/100; double amount=SimpleInterest+principle; System.out.println("Simple Interest earned is "+ SimpleInterest); System.out.println("Amount earned is "+ amount); } }
This code will generate the following result:
00Enter Priciple,Rate and Time 10000 5 10 Simple Interest earned is 5000.0 Amount earned is 15000.0
Hope this helped you out.
Do let me know if you have any doubt regarding anything in the comments section down below.
Have a nice day ahead.
Also Read:
Leave a Reply