1. Introduction

In this post, we will explore a Java program to calculate Simple Interest. Simple Interest is a quick method of calculating the interest charge on a loan. It is determined using the formula: Simple Interest (SI) = P * R * T, where:

– P is the principal amount (initial investment or loan amount),

– R is the rate of interest per period,

– T is the time the money is deposited or borrowed for in years.

2. Program Steps

1. Define a class named SimpleInterest.

2. In the class, define the main method.

3. In the main method, declare variables for principal (P), rate of interest (R), and time (T).

4. Use the simple interest formula to calculate the simple interest.

5. Print the calculated simple interest.

3. Code Program

public class SimpleInterest { // Step 1: Define a class named SimpleInterest

    public static void main(String[] args) { // Step 2: Define the main method

        // Step 3: Declare variables for principal, rate of interest, and time
        double principal = 10000; // Initial amount of money
        double rate = 0.05; // Rate of interest per period in decimal
        double time = 5; // Time in years

        // Step 4: Use the simple interest formula to calculate the simple interest
        double simpleInterest = principal * rate * time;

        // Step 5: Print the calculated simple interest
        System.out.println("Simple Interest after " + time + " years: " + simpleInterest);
    }
}

Output:

Simple Interest after 5 years: 2500.0

4. Step By Step Explanation

Step 1: A class named SimpleInterest is defined.

Step 2: The main method is defined within the SimpleInterest class.

Step 3: Variables for principal (principal), rate of interest (rate), and time (time) are declared and initialized.

Step 4: The simple interest formula is used to calculate the simple interest.

Step 5: The calculated simple interest is printed out.