System.out.println("payment\ttotal\tinterest principal balance"); System.out.println("number\tpayment\tpayment\tpayment"); System.out.println("\t\t\t\t" + bal); for (short mo = 1; mo <= npmts; ++mo) { double prinpmt, intpmt = bal * intmo; if (mo < npmts) prinpmt = pmt - intpmt; else prinpmt = bal; bal -= prinpmt; System.out.println(mo + "\t" + format(intpmt + prinpmt) + "\t" + format(intpmt) + "\t" + format(prinpmt) + "\t" + format(bal)); } } }