Ok so im not gonna fail the class... but it does decide if ill have a C or B. lol. The assignment goes like this (given by teacher):
The assignment is to develop a menu-driven program to analyze a loan. Assume the loan is repaid in equal monthly payments and interest is compounded monthly. The program should request the amount (principal) of the loan, the annual rate of interest, and the number of years which the loan is to be repaid. The four options in the menu are as follows:
1. Calculate the monthly payment. The formula for the monthly payment is payment = P + r / (1 - (1 + r)^(-n) where p is the principal of the loan, r is the monthly interest rate (annual rate divided by 12) given as a number between 0 (for 0 percent) and 1 (for 100 percent), and n is the number of months over which the loan is to be repaid.
2. Display an amortization schedule, that is, a table showing the balance on the loan at the end of each month for the duration of the loan. Also show how much of each monthly payment goes toward the interest and how much is used to repay the principal. Finally, display the total interest paid over the duration of the loan. The balances for successive months are calculated with the formula:
Balance = (1 + r) * b - m
Where r is the monthly interest rate (annual rate / 12, a fraction between 0 and 1), b is the balance for the preceding month (amount of loan left to be paid), and m is the monthly payment.
3. Show the effect of changes in the interest rate. Display a table giving the monthly payment for each interest rate from 1 percent below to 1 percent above the specified amount in steps of one-eighth of a percent.
4. Quit.
Designing the Analyze a Loan Program
In addition to the tasks described in options 1 to 3 above, the basic tasks of this program include inputting the particulars of the loan to be analyzed and presenting a menu to the user. Thus, the first division of the problem is into the following tasks:
1. Input principal, interest, duration.
2. Present menu and get choice.
3. Calculate monthly payment.
4. Calculate amortization schedule.
5. Display the effects of interest rate changes.
6. Quit.
Tasks 1 and 2 are basic input operations and task 3 involves applying the formula in step 1; therefore, these tasks need not be broken down any further. The demanding work of the program is done in tasks 4 and 5, which can be divided into smaller subtasks:
4. Calculate and Print an amortization schedule. This task involves simulating the loan month by month. First, the monthly payment must be computed. Then, for each month, the new balance must be computed together with a decomposition of the monthly payment into the amount paid for interest and the amount going toward repaying the principal. That is task 4 divided into the following subtasks:
4.1 Calculate monthly payment
4.2 Calculate new balance
4.3 Calculate amount of monthly payment for interest
4.4 Calculate amount of monthly payment for principal
5. Display and print the effects of interest rate changes. A table is needed to show the effects of changes in the interest rate on the size of the monthly payment. First the interest rate is reduced by one percentage point and the new monthly payment is computed. Then the interest rate is increased by regular increments until it reaches one percentage point over the original rate, with the new monthly payment amounts computed for each intermediate interest rate. The subtasks for this task are then :
5.1 Reduce interest rate by 1 percent
5.2 Calculate monthyl payment
5.3 Increase interest rate by 1/8 percent
When the program is completed you will be given the necessary input to "test" you work.
I really would appreciate help with this... my teacher is nuts. We have only had 4 computers for a class of 17 the entire year... and weve only been able to get to the Loop section in our textbook. Please help, i have no clue what this program is asking for, i really dont understand tasks 4 and 5. Will i need to use FUNCTIONS for the formulas given? SUBS? Very confused and dont underestand interest rate stuff. UGH. PLEASE HELP. THANK YOU for atleast reading this far.
