for (short mo = 1; mo <= npmts; ++mo) { double prinpmt, intpmt = bal * intmo; if (mo < npmts) prinpmt = pmt - intpmt; else prinpmt = bal; bal -= prinpmt; msg.append(mo + "\t" + format(intpmt + prinpmt) + "\t" + format(intpmt) + "\t" + format(prinpmt) + "\t" + format(bal) + "\n"); } msgArea.setText(msg.toString()); } } }