In this program, we are going to share Java program to calculate simple interest with the output. If you are a Java beginner and want to start learning the Java programming, then keep your close attention in this tutorial as I am going to share how to write a Java program to calculate simple interest with the output.
Copy the below Java program and execute it with the help of Javac compiler. At the end of this program, We have shared the output of this program.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import java.util.Scanner; public class Simple_Interest { public static void main(String args[]) { float p, r, t; Scanner s = new Scanner(System.in); System.out.print("Enter the Principal : "); p = s.nextFloat(); System.out.print("Enter the Rate of interest : "); r = s.nextFloat(); System.out.print("Enter the Time period : "); t = s.nextFloat(); float si; si = (r * t * p) / 100; System.out.print("The Simple Interest is : " + si); } } |
$ javac Simple_Interest.java
$ java Simple_Interest
Enter the Principal : 20202
Enter the Rate of interest : 2.5
Enter the Time period : 3
The Simple Interest is : 1515.15
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: java interest rate program, Java Program to calculate Simple Interest, java program to find simple interest using methods, program to calculate simple interest, simple interest program in java netbeans, simple interest program in java using command line arguments, simple interest program in java using methods