-3

编写一个方法来计算在给定年数内以给定的连续复利利率偿还贷款所需的每月付款。该方法以年数 t、本金 P 和年利率 r 作为参数。所需值由公式 (P ert/ 12 t) 给出。使用 Math.exp()。该方法的签名应该是:public static double monthlyPayment(double years, double principal, double rate)使用该方法编写一个程序 Payments,该程序生成一组每月付款,一个人必须在 5 年内以 5% 到 8% 的利率以 0.25% 的增量进行 20,000 美元的贷款.

public class Payments {

    public static void main(String[] args) {
        for(double r=0.05; r<=0.08; r+=0.0025) {
            System.out.println(monthlyPayment(5,20000,r));
        }

    }
    public static double monthlyPayment(double years,double principal,double rate) {
        return ((principal*(Math.exp(years*rate)))/(12*years));
    }

}

这是我到目前为止写的内容,我不确定实际上该怎么做,我不明白以 0.25% 的增量从 5% 变化到 8% 的意思是什么!有人可以解释一下吗?

4

1 回答 1

2

问题是告诉您为

5.00%
5.25%
...
...
7.75%
8.00
于 2013-10-15T18:34:53.617 回答