package com.imsl.test.example.finance; import com.imsl.finance.*; import java.text.NumberFormat; /** *
* Computes the amount of principal paid in the first year of a 30 year fixed * rate mortgage. *
* * The amount of principal 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. * * @see Code * @see Output */ public class FinanceCumprincEx1 { 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.cumprinc(rate, periods, pv, start, end, Finance.AT_END_OF_PERIOD); System.out.println("First year principal = " + NumberFormat.getCurrencyInstance().format(total)); } }