Example: Cumulative Interest Example

The amount of interest paid in the first year of a 30 year fixed rate mortgage is computed. The amount financed is $200,000 at an interest rate of 7.25% for 30 years.

import com.imsl.finance.*;
import java.text.NumberFormat;

public class cumipmtEx1 {

    public static void main(String args[]) {
        double rate = 0.0725 / 12;
        int periods = 12 * 30;
        double pv = 200000;
        int start = 1;
        int end = 12;
        double total;

        total = Finance.cumipmt(rate, periods, pv, start, end,
                Finance.AT_END_OF_PERIOD);

        System.out.println("First year interest = "
                + NumberFormat.getCurrencyInstance().format(total));
    }
}

Output

First year interest = ($14,436.52)
Link to Java source.