COSC 135 B Programming Assignment 3
Due Friday 10-6-00

Work alone on this assignment.

  1. In a file named Loan.java, write a program that allows the user to enter a purchase price, down payment percentage, and an annual interest rate (like 0.22 for 22%) for a loan. Assuming that the user must pay the larger of $25 or 5% of the remaining balance (or all of the loan amount, if the total balance is less than $25) each month, and that interest is added each month, your program should print out a nicely formatted table (with header labels on the columns) that lists
    1. the month number (starting with 1);
    2. the current total balance owed (at the beginning of the month);
    3. the interest owed for that month;
    4. the total amount of interest paid so far;
    5. the principal owed for that month;
    6. the total amount of principal paid so far.
    Recall that to add 6% of a number (say B) to itself, you can just multiply B by (1 + 0.06). As well, 7% annual interest is equivalent to an monthly interest rate of 0.07 / 12.0, so the interest owed for a month is simply the current balance multiplied by (1 + r / 12.0), where r is the annual interest expressed as a decimal. As a sample, if I borrow $5000, with 2.5% down at 13.2% annual interest, I will owe $4875 at the start of month 1. My interest for month 1 is $53.63 (4875 * 0.132 / 12.0). My payment will be 0.05 * 4875 = $243.75, so I will pay off 243.75 - 53.63 = $190.12 of the principal.

    This is similar to number 12 at the end of chapter 4 in the text.