我的程序中有两个错误是什么?

时间:2015-07-18 17:13:46

标签: java

你能帮我确定这里的错误吗? 请你能解决它吗

import java.util.*;
import java.lang.*;

class Loan_payment
{  
    public static void main(String args[])
    {
      double inst=0.4, loan_amt=0.56, pay=0.34;   
      double mon = (inst/1200);
      double quarterly = (inst/400);
      double Half = (inst/200);
      double annual = (inst/100);

     //Mothly
     double ad = 1 + mon;      
     double amt,amt_mon,amt2; 
     amt_mon = -1*((Math.log( 1 - ((mon * loan_amt) / pay))));
     amt2 =(Math.log(ad));
     amt = (amt_mon / amt2);
     System.out.println("Number of Payments based on monthly : "+amt);

     //Quarterly
     ad = 1 + quarterly;
     double amt_quart;
     amt_quart = (( -Math.log( 1 - ((quarterly * loan_amt) / pay))));
     amt = (amt_quart / amt2);
     System.out.println("Number of Payments based on quarterly : "+amt);

     //HalfYearly
     ad = 1 + Half;
     double amt_half;
     amt_half = (( -Math.log( 1 - ((Half * loan_amt) / pay))));
     amt = (amt_half / amt2);
     System.out.println("Number of Payments based on HalfYearly : "+amt);

     //Annually
     ad = 1 + annual;
     double amt_ann;
     amt_ann = (( -Math.log( 1 - ((annual * loan_amt) / pay))));
     amt = (amt_ann / amt2);
     System.out.println("Number of Payments based on Annually : "+amt);
  }
}

你能帮我确定这里的错误吗?

1 个答案:

答案 0 :(得分:0)

没有任何错误,给出输出: -

Number of Payments based on monthly : 1.6477856928143282
Number of Payments based on quarterly : 4.94607431098997
Number of Payments based on HalfYearly : 9.900315277456814
Number of Payments based on Annually : 19.833405363765696