StringBuffer msg = new StringBuffer(); msg.append("\nprincipal=" + bal + " interest=" + intyr + " years=" + nyears + "\n"); double intmo = intyr / 12.; int npmts = nyears * 12; double pmt = bal * (intmo / (1.- Math.pow(1.+ intmo,-npmts))); msg.append("payment\ttotal\tinterest\tprincipal\tbalance\n"); msg.append("number\tpayment\tpayment\tpayment\n"); msg.append("\t\t\t\t" + bal + "\n");