Best Way To Find Simple Interest In Java

Sharing is healthy !!

You are here to learn the best way to find simple interest in java. Let us understand what is simple interest with an example.

what is simple interest?

Simple interest is a method to enumerate interest on invested amount or loan. It is calculated by multiplying principle amount, rate and time.

Simple Interest = (Principal Amount * Rate * Time) / 100

example: Best Way To Find Simple Interest In Java

Also Read – Print Multiplication Tables Of Any Number In Java

import java.util.Scanner;

public class SimpleInterestInJava
{ 
   public static float SimpleInterest(float valuePrinciple, float valueRate, float valueTime)
   {
      float calInterest = (valuePrinciple * valueRate * valueTime) / 100;
      return calInterest;
   }

   public static void main(String[] args)
   {
      Scanner sc = new Scanner(System.in);
      System.out.println("Best way to find Simple Interest In Java");
 
      System.out.println("Please enter principal amount: " );
      float getAmount = sc.nextFloat();
 
      System.out.println("Please enter time(in years): ");
      float getTime = sc.nextFloat();
 
      System.out.println("Please enter rate annually: ");
      float getRate = sc.nextFloat();
 
      float getInterest = SimpleInterest(getAmount, getRate, getTime);
 
      System.out.println("Simple Interest is: " + getInterest);

   }
}

Output:

Best Way To Find Simple Interest In Java

Sharing is healthy !!