// 等额本息计算公式:〔贷款本金×月利率×(1+月利率)^还款月数〕÷〔(1+月利率)^还款月数-1〕
 // 等额本金计算公式:每月还款金额 = (贷款本金 / 还款月数)+(本金 — 已归还本金累计额)×每月利率

(还没有做封装,稍后会把封装好的工具类及代码注释放上)
public class DaiKuan {
 public static void main(String[] args) {
  task(10000, 7.05d/100, 120);
  DE(10000, 7.05d/100, 120);
  ZH(45000, 4.9d/100, 400000, 7.05d/100, 20*12);
 }
//等额本金
 public static void task(int benjin, double lilv, int yueshu) {
  double a = Math.pow((1+lilv/12),yueshu );
  double pay = (benjin * lilv/12 * a) / (a - 1);
  System.out.println("每月还款额数是pay=" + pay);

 }
 //等额本息
 public static void DE(int benjin, double lilv, int yueshu){
  double a = 0;
  double b = 0;
  for(int i = 1;i<=yueshu;i++){
   b = (benjin/yueshu)+ (benjin- a)*lilv/12;
   a = a+ b;
      System.out.println("第"+i+"个月还款金额是pay=" + b);
  }
 }
 
 //组合贷款
 public static void ZH(int gjj,double glv,int sy,double slv,int yueshu){
  double a = Math.pow((1+glv/12),yueshu );
  double b = Math.pow((1+slv/12),yueshu );
  double pay = ((gjj * glv/12 * a) + (sy*slv/12*a))/ (a - 1) ;
  System.out.println("每月还款额数是pay=" + pay);
 }
}