Java Program to Calculate Simple Interest

Simple interest is a quick method of calculating the interest charge on a loan. Simple interest is determined by multiplying the daily interest rate by the principal by the number of days that elapse between payments.

Simple interest formula is given by:

Simple Interest = (P x T x R)/100 

Where,

Examples: –

Example 1:

Input : P = 10000
R = 5
T = 5
Output : 2500

Explanation - We need to find simple interest on
Rs. 10, 000 at the rate of 5% for 5
units of time.

Example 2:

Input : P = 3000
R = 7
T = 1
Output : 210

Example 1:


Output
Simple interest = 0.01

Time Complexity: O(1)
Auxiliary Space: O(1)

Example 2:


Output
Simple interest = 2500.0

Time Complexity: O(1)
Auxiliary Space: O(1)

Please refer complete article on the Program to find simple interest for more details!

GeeksforGeeks Like Article -->

Please Login to comment.

Similar Reads

Java Program to Calculate Interest For FDs, RDs using Inheritance

Inheritance is an important pillar of OOP(Object-Oriented Programming). It is the mechanism in java by which one class is allowed to inherit the features(fields and methods) of another class. In this article, we will create an application to calculate interest for FDs, RDs based on certain conditions using inheritance. Create three classes in a sin

6 min read Java Program for compound interest

Compound Interest formula: Formula to calculate compound interest annually is given by: Compound Interest = P(1 + R/100)t Where, P is principal amount R is the rate and T is the time span Example: Input : Principal (amount): 1200 Time: 2 Rate: 5.4 Output : Compound Interest = 1333.099243 Java Code // Java program to find compound interest for // gi

1 min read Java Program for Program to calculate volume of a Tetrahedron

A Tetrahedron is simply a pyramid with a triangular base. It is a solid object with four triangular faces, three on the sides or lateral faces, one on the bottom of the base and four vertices or corners. If the faces are all congruent equilateral triangles, then the tetrahedron is called regular. The volume of the tetrahedron can be found by using

1 min read Java Program For Printing 180 Degree Rotation of Simple Half Left Pyramid

We can utilize 'for' and 'while' loops to print a 180-degree rotation of a simple half-left pyramid in Java as follows: Example of 180-degree Rotation of Simple Half-Left PyramidRows = 5Output : * * * * * * * * * * * * * * * Methods For Printing 180-Degree Rotation of Simple Half-Left PyramidThere are certain methods to Print the 180-rotated Simple

3 min read Java Program to Calculate Power of a Number

Given a number N and a power P, the task is to find the exponent of this number raised to the given power, i.e. NP. Examples: Input: N = 5, P = 2 Output: 25 Input: N = 2, P = 5 Output: 32 Below are the various ways to find NP: Method 1: Using Recursion Java Code // Java program to find the power of a number // using Recursion class GFG < // Functio

2 min read Java Program to Calculate Sum of Two Byte Values Using Type Casting

The addition of two-byte values in java is the same as normal integer addition. The byte data type is 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127 (inclusive). The Sum of two-byte values might cross the given limit of byte, this condition can be handled using storing the sum of two-byte numbers in

2 min read

Java Program to Calculate the Difference Between the Sum of the Odd Level and the Even Level Nodes of a Binary Tree

Graph Traversal using DFS is an obvious way to traverse a tree with recursion. Below is an algorithm for traversing binary tree using DFS. Prerequisites Graph Traversal using DFSJava Basics(Array List)Recursion Basics Algorithm Initialize the current node as root node and the parent as -1.Traverse the Binary Tree as the in the general DFS fashion a

2 min read Java Program to Calculate Standard Deviation

The standard deviation is the measure of how spread out numbers are. Its symbol is sigma( σ ). It is the square root of variance. The task is to calculate the standard deviation of some numbers. Consider an example that consists of 6 numbers and then to calculate the standard deviation, first we need to calculate the sum of 6 numbers, and then the

3 min read Java Program to Calculate Difference Between Two Time Periods

In this article, let's explore the various methods to find the difference between the Two Time Periods in Java. For simplicity, let's assume that the Time Period provided to us is in the format HH:MM:SS Example Input : 1st Time Period :- 18:00:00 2nd Time Period :- 21:00:00 Output: 3 hours 0 minutes and 0 seconds Input : 1st Time Period :- 17:00:00

3 min read Java Program to Calculate and Display Area of a Circle

Given a radius of the circle, write a java program to calculate and display the area of the circle. (Take ∏=3.142) Example Input : radius= 5 Output: Area of circle is : 78.55 Input : radius= 8 Output: Area of circle is : 201.08As we know to calculate the area of a circle, the radius of the circle must be known, so if the radius of the circle is kno

1 min read Java Program to Calculate Sum of First N Natural Numbers

In this article, we will check How to calculate the sum of N natural numbers using an iterative approach i.e. using a for a loop and Mathematical Formulae. Example to Find Sum of N Natural Numbers:Input: N = 10Output: Sum of first 10 Natural Number = 55 Input: N = 5Output: Sum of first 5 Natural Number = 15 Methods to Find the Sum of N Natural Numb

4 min read Java Swing | Simple Calculator

Java Swing is a GUI (graphical user Interface) widget toolkit for Java. Java Swing is a part of Oracle's Java foundation classes . Java Swing is an API for providing graphical user interface elements to Java Programs.Swing was created to provide more powerful and flexible components than Java AWT (Abstract Window Toolkit).In this article we will us

4 min read Java Swing | Create a simple text editor

To create a simple text editor in Java Swing we will use a JTextArea, a JMenuBar and add JMenu to it and we will add JMenuItems. All the menu items will have actionListener to detect any action.There will be a menu bar and it will contain two menus and a button: File menuopen: this menuitem is used to open a filesave: this menuitem is used to save

6 min read Java Swing | Simple User Registration Form

Swing is a part of the JFC (Java Foundation Classes). Building Graphical User Interface in Java requires the use of Swings. Swing Framework contains a large set of components which allow a high level of customization and provide rich functionalities, and is used to create window-based applications. Java swing components are lightweight, platform-in

5 min read Simple Bill Splitter Application using Java Servlets

Pre-requisite: Java Servlets Servlets is a Java Technology for server-side programming generally used to create web applications. It is a module that runs inside a Java-enabled web server. Here, you will see the implementation by developing a Bill Splitter Application. In this Java Servlets app, there are two input columns one for the total bill am

4 min read How to Build a Simple Voice Typer App in Android using Java?

Pre-requisites: Android App Development Fundamentals for BeginnersGuide to Install and Set up Android StudioHow to Create/Start a New Project in Android Studio?Running your first Android appSpinner in AndroidRecognizerIntent in Android In this article, we are going to build a simple Voice Typer app in Android using Java. This is a glimpse of the ap

5 min read Simple Calculator using Java Socket Programming

Prerequisite: Socket Programming in Java First, we understand the basics of java socket programming. Java Socket is used to communicate between two different JREs. Java socket can be connection-oriented or connection-less. In java, we have a package called "java.net". In this package, we have two classes Socket Class and Server Class. Those classes

3 min read Create a Simple Login Web Application with Encrypted Password in Java

Security is an important concept in any web application. We need to have the passwords stored in an encrypted way i.e. the passwords are not easily accessible by hackers or unauthorized users. Let's see a small demo application in this article using MySQL, Java, Servlet, and JSP technology. Step by Step Implementation Required MySQL Script -- Here

10 min read Simple Calculator using TCP in Java

Prerequisite: Socket Programming in Java Networking just doesn't conclude with a one-way communication between the client and server. For example consider a time telling server which listens to request of the clients and respond with the current time to the client. Real-time applications usually follow a request-response model for communication. Th

5 min read Simple Calculator via UDP in Java

Networking is two-way communication between a host and a server, rather than an exchange of information. Any server is set up to respond to specific queries as requested by a client. There are many different kinds of servers based on the utility they provide to the users. Some examples include File Server, Application Server, Domain Server, etc.Let

7 min read Difference between Simple and Compound Assignment in Java

Many programmers believe that the statement "x += i" is simply a shorthand for "x = x + i". This isn’t quite true. Both of these statements are assignment expressions. The second statement uses the simple assignment operator (=), whereas the first uses a compound assignment operator. The compound assignment operators are +=, -=, *=, /=, %= etc. The

2 min read How to Implement a Simple Network Monitoring Tool in Java?

In Java, to perform the simple operation of networked systems, admins and users need network monitoring tools. In this article, we will learn how to make a simple Java-based network monitoring tool that lets users keep track of network devices. Steps to Implement a Simple Network Monitoring Tool in JavaThe steps to implement a simple network monito

2 min read How to Create a simple TCP Client-Server Connection in Java?

TCP can be defined as Transmission Control Protocol. This is the standard protocol for transmitting data over a network. It provides reliable, structured, and error-checked data delivery between applications running on hosts connected via an IP (Internet Protocol) network. In Java, we can create TCP client-server connections using the Socket and Se

3 min read How to implement a Simple DNS Resolver in Java?

DNS stands for Domain Name System. For the implementation of the simple DNS resolver in Java is allowed to translate the domain names into the corresponding IP addresses in the programmatically. Domain Name System (DNS) plays a crucial component of internet communication and translates human-readable domain names such as "example.com" and "google.c

3 min read How to Implement a Simple Chat Application Using Sockets in Java?

In this article, we will create a simple chat application using Java socket programming. Before we are going to discuss our topic, we must know Socket in Java. Java Socket connects two different JREs (Java Runtime Environment). Java sockets can be connection-oriented or connection-less. In Java, we have the java.net package. Java Socket can be conn

4 min read Program to calculate the value of nPr

Given two numbers n and r, the task is to find the value of nPr. nPr represents n permutation r which is calculated as n!/(n-k)!. Permutation refers to the process of arranging all the members of a given set to form a sequence. The number of permutations on a set of n elements is given by n! where “!” represents factorial. nPr = n! / (n - r)! Progr

3 min read Program to calculate Electricity Bill

Given an integer U denoting the amount of KWh units of electricity consumed, the task is to calculate the electricity bill with the help of the below charges: 1 to 100 units - [Tex]Rs. 10/unit[/Tex]100 to 200 units - [Tex]Rs. 15/unit[/Tex]200 to 300 units - [Tex]Rs. 20/unit[/Tex]above 300 units - [Tex]Rs. 25/unit[/Tex] Examples: Input: U = 250 Outp

9 min read How to calculate log base 2 of an Integer in Java?

Given an integer N, the task is to calculate its log to the base 2, i.e. log2 N in Java. Examples: Input: N = 2 Output: 1 Input: 1024 Output: 10 Approach: Math class in Java (java.lang.Math) is a library which holds the functions to calculate such values, like sin(), cos(), log() etc. But the log() method in Math class calculates the log to the bas

2 min read Build a Calculate Expression Game in Java

Java is a class-based, object-oriented programming language and is designed to have as few implementation dependencies as possible. A general-purpose programming language made for developers to write once run anywhere that is compiled Java code can run on all platforms that support Java. Java applications are compiled to byte code that can run on a

14 min read Calculate the Sum and Average of Elements in an ArrayList in Java

A Dynamic and Adaptable method for storing and managing collections of elements is to use ArrayList. Finding the total and average of an ArrayList's items is frequently required when working with numerical data that is stored in the list. In this article, we will see how we can sum and find the average of the ArrayList in Java. Methods to Calculate