How to make a console application for calculating loan EMI in Java?



Loan is taken for the purpose of purchasing things that we cannot buy from our saving account. Loans are offered by financial institutions like Banks. There are two types of banks private banks and commercial banks. Reserve banks of India govern all the banks operating in India. The Loans are given to the loan seekers at an interest from the banks. These interests are to be paid within the fixed date otherwise bank will charge extra money.

People are interested to know the EMI or the monthly installments that they need to pay once the loan is approved. Hence making the console application for calculation of the Loan EMI is the best way to help the customers know their monthly installments.

  • First of all we need to download and install the Java development SDK from its official site.
  • Then we need notepad to write the code.


To download the source file Click Here.

Explanation of the code

First of all we need to import two important Java reseource file from library

import java.util.*;

import java.util.Scanner;

Create a class named EMI which is also the name of the file with .java extension

Open the main function

public static void main(String []args)

 

  System.out.print("Enter principal: ");

        principal = a.nextFloat();

     

        System.out.print("Enter rate: ");

        rate = a.nextFloat();

     

        System.out.print("Enter time in year: ");

        time = a.nextFloat();


we create another function with p, r and t parameter

 

Use the formula

static double emiCalculation(double p,double r,double t)

    {

      double e= (p*r*Math.pow(1+r,t))/(Math.pow(1+r,t)-1);

      return e;

    }


Compile the code

Open command prompt and wite



javac Emi.java

Execute the code



java Emi

If you want to hire offshore Java developers or Java programmers for Java application development then you can easily hire them by contacting us.

The output will look like this 





Post a Comment

Previous Post Next Post

Contact Form