Q:

EMI Calculator in Java - Java program to calculate EMI

0

EMI Calculator in Java - Java program to calculate EMI

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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

    me@linux:~$ javac EmiCalc.java 
    me@linux:~$ java EmiCalc 

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

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Core Java Example programs for Beginners and Professionals

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Java program to calculate Simple Interest... >>
<< Java program to Calculate Perimeter of a Circle...