Due Wednesday, 1999/09/29
Read sections 4.1 through 4.8 in Deitel and Deitel. Optionally, read sections 3.4 and 3.5 in Kernighan and Ritchie.
Write a program which prints a payment schedule for a simple-interest loan. The program should prompt you for the principal amount of the loan (how much you borrowed), the annual interest rate, and the number of monthly payments. Each month, you will pay an equal portion of the principal, plus any interest that has accrued during the prior month.
For example, suppose you borrowed $60,000, at 6 percent, to be paid back over 60 months (5 years). At the end of the first month you would pay $1000 of the principal, plus one month's worth of interest on the principal, (6.0 / 100) / 12 * 60,000 = $300 (one twelfth of 6 percent times the principal balance). At the end of the second month you would pay another $1000 of the principal, plus one month's worth of interest on the prior principal balance of $59,000 ($295), and so on. In the final month, you would pay the last $1000 of principal and $5 in interest.
When you run your program it should look something like this:
$ ./simple_interest
simple_interest -- computes payment schedule for a simple-interest loan.
Enter the principal amount.
60000
Enter the annual interest rate.
6
Enter the number of months.
60
Month Principal Interest Payment Balance
1 60000.00 300.00 1300.00 59000.00
2 59000.00 295.00 1295.00 58000.00
.
.
.
60 1000.00 5.00 1005.00 0.00
Copyright © 1999, Ray Ontko (rayo@ontko.com).