Programming Assignment #3


Pay off that credit card!!!!

Suppose you buy something on your credit card for $1000 . The terms on your credit card are 1% interst per month on the outstanding balance. Also suppose you send the credit card company $100 per month. How long will it take to pay off the loan ?

We proceed as follows:

In month 1, we owe the principle ($1000) plus the interest ($10 = .01 * $1000) less the payment ($100) or $910
In month 2, we owe the principle ($910) plus the interest( $9.10 = .01 * $910) less the payment ($100) or  $819.10
In month 3, we owe the principle ($819.10) plus the interest ($8.19 = .01 * $819.10) less the payment ($100) or $727.29
etc.......

After a certain amount of time, the principle owed plus the interst for the month will be <= $100. That will be the last month a payment is required.

We could put this information neatly into a table:


Month   Principle   Interest   Payment   Balance
1            1000.0      10.0          100.00     910.00
2            910.0        9.10          100.00     819.10
3            819.10      8.19          100.00     727.29
etc.......

Your assignment:

Write a complete Java program that will prompt the user to enter amount borrowed, monthly interest rate, and monthly payment. Each prompt should be on a seperate line. For example:

Enter amount borrowed      <program prompt>
1000.00                              <user response>
Enter monthly interest rate   <program prompt>
0.01                                    <user response>
Enter monthly payment      <program prompt>
100.0                                 <user response>

Your program should then output a table that looks as close to the above table as possible (we will need to discuss System.out.printf()  )

The last line of output should correspond to the final payment. Your table should NOT ever show a negative balance. You may make use of the break statement, but extra credit will be given to any program that DOES NOT use a break statement.

What to hand in:
1) A flow chart demonstrating the logic of this program. You should do the flow chart before you write your code.
2) A well documented source listing. We will ask you to demonstrate your program!

PLEASE NOTE: You will be penalized 33% of your total grade if your actual program does not correspond to your flow-chart