JAVA Program to Find Simple Interest with Output

Hi friends! Here we will see how to calculate simple interest using JAVA Program. We will see each and every line of code in the explaination part of the program.

Following code illustrates JAVA Program to find Simple Interest:

/* JAVA Program to Calculate Simple Interest
* Created by: Mayuresh Joshi (myclassbook.org)
*/
public class SimpleInterest {
public static void main(String[] args) {
int Amount=12000;                    //Principle Amount = 12000Rs.
float rate=0.08f;                            //Interest Rate = 8%
int time=3;                                        //For 3 years
float SimpleInterest= (Amount*rate*time)/100;
System.out.println(“Simple Interest=”+SimpleInterest);
}
}

Explaination:

public class SimpleInterest:

In JAVA programming language Classes are generic representations of Objects in problem scenarios. Here our object is Simple Interest. So to define this object we have used class SimpleInterest. Also The public access modifier is accessible everywhere in the program. It has the widest scope among all other modifiers. Therefore we have used public as access modifier.

public static void main(String[] args) :

The keyword “static” allows main( ) to be called without having to instantiate a particular instance of the class. Void keyword tell the compiler that main() function does not return a value.

Initialising variables:

float SimpleInterest= (Amount*rate*time)/100;

Here we have defined Simple interest formula. We have used variable name as SimpleInterest and its data type is float. Make sure that you have used float data type because simple interest might be fractional.

System.out.println(“Simple Interest=”+SimpleInterest);

Finally we will display the result of simple interest on console. To display Simple Interest we have used System.out.println.

program to calculate simple interest with output:

Simple Interest Java Program
Simple Interest Java Program

You can also download the JAVA program to find simple interest from this link: Download

I hope you have understood how to write JAVA Program for finding Simple Interest. If you liked this article dint forget to like our facebook page and share this article with your friends. Have a nice day!

https://drive.google.com/file/d/0B4X5fDQ-lNL8eVR5YmM4Q3JpUlE/view