ADVERTISEMENT
ADVERTISEMENT

EMI Calculator in Java - Java program to calculate EMI

EMI Calculator in Java - This program will read Loan Amount, Interest Rate and Time in Years and calculate monthly EMI.

EMI Calculator Program in Java

//EMI Calculator Program in Java
 
import java.util.*;
 
public class EmiCalc{
 
    public static void main(String []args)
    {
         
        //Scanner class to take user input.
        Scanner X = new Scanner(System.in);
         
        double principal, rate, time, emi;
  
        System.out.print("Enter principal: ");
        principal = X.nextFloat();
      
        System.out.print("Enter rate: ");
        rate = X.nextFloat();
      
        System.out.print("Enter time in year: ");
        time = X.nextFloat();
      
        rate=rate/(12*100); /*one month interest*/
        time=time*12; /*one month period*/
      
      
        emi= (principal*rate*Math.pow(1+rate,time))/(Math.pow(1+rate,time)-1);
      
        System.out.print("Monthly EMI is= "+emi+"\n");
                 
    }
}

Output

    [email protected]:~$ javac EmiCalc.java 
    [email protected]:~$ java EmiCalc 

    Enter principal: 1000000
    Enter rate: 10.25
    Enter time in year: 10
    Monthly EMI is= 13353.900187677658

Core Java Example Programs »


ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.