Pin It

How to calculate Simple Interest in Java ?.

Program to calculate Simple Interest in Java

import java.util.Scanner;

public class SimpleInterest {

  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);

    double principal = 0;
    double rate = 0;
    double time = 0;

    double simpleInterest = 0;
  
    System.out.print("Enter the Principal amount : "); 
    principal = input.nextDouble();

    System.out.print("Enter the Rate : "); 
    rate = input.nextDouble();

    System.out.print("Enter the Time : "); 
    time = input.nextDouble();

    simpleInterest = (principal * rate * time) / 100;
    
    System.out.println("");
    System.out.println("The Simple Interest is : "
                        + simpleInterest);
  
  }

}


Output of the program :

















Watch the above Java tutorial on Youtube video :

 
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Related Posts Plugin for WordPress, Blogger...

Post your related queries below ...

comments powered by Disqus
Powered by Blogger.
 
© 2012 Learn Java by Examples Template by Hubber Spot