Ok, I modified the code a bit.... this is the improved amortization method....
CODE
public void amortization()
{
System.out.println();
System.out.println("Amortization Schedule");
System.out.println();
System.out.println("Loan Amount: " + principal);
System.out.println("Yearly Interest: " + percent);
System.out.println("Montly Payment: " + monthlyPmt);
double Loan = principal;
do
{
interestPmt = round(principal*monthlyRate);
principalPmt = round(monthlyPmt - interestPmt);
principal = round(principal - principalPmt);
pmtNr ++;
if(monthlyPmt > principal)
{
excess = principal;
}
System.out.println(pmtNr+" \t"+monthlyPmt+" \t"+interestPmt+" \t"+principalPmt+" \t"+principal);
}
while (principal > 0);
totalPmt = pmtNr * (monthlyPmt)+ excess;
totalInt = round(totalPmt - Loan);
System.out.println("Payback Months: " + pmtNr);
System.out.println("Total Payments: " + totalPmt);
System.out.println("Total Interest: " + totalInt);
}
My output is this if I enter 1000 as the loan amount, 13.5 as the yearly interest, and 250 as the monthly payment:
Select one of the following options
[1] Monthly Loan Payment Computation
[2] Amortization Schedule
[3] Credit Card Pay-Off Schedule
Enter your choice ===>> 2
Enter principle balance ===>> 1000
Enter annual percent ===>> 13.5
Enter monthly payment ===>> 250
Amortization Schedule
Loan Amount: 1000.0
Yearly Interest: 13.5
Montly Payment: 250.0
1 250.0 11.25 238.75 761.25
2 250.0 8.56 241.44 519.81
3 250.0 5.85 244.15 275.66
4 250.0 3.1 246.9 28.76
5 250.0 0.32 249.68 -220.92
Payback Months: 5
Total Payments: 1029.08
Total Interest: 29.08
I'm getting the correct final answers now, but the last output line of the amortization chart has a negative principal, and the last monthly payment should display 29.08... not 250.... help please? Thanks =)