Get your original paper written from scratch starting at just $10 per page with a plagiarism report and free revisions included!
The monthly payments for a given loan are divided into amounts that apply to the principal and to the interest. For example, if you make a monthly payment of $500, only a portion of the $500 goes to the principal and the remainder is the interest payment. The monthly interest is computed by multiplying the monthly interest rate by the unpaid balance. The monthly payment minus the monthly interest is the amount applied to the principal. The following table is the sample loan payment schedule for a 1-year loan of $5000 with a 12 percent annual interest rate.
Write a program that accepts a loan amount, annual interest rate, and loan period (in number of years) and displays a table with five columns: payment number, the interest and principal paid for that month, the remaining balance after the payment, and the total interest paid to date. Note: The last payment is generally different from the monthly payment, and your program should print out the correct amount for the last payment. Use the Format class to align the output values neatly.