You are to write a program that twill calculate the monthly mortgage payment for an input matrix of loan amounts for 15 and 30 years. The equation that calculates your monthly payments is:
|
rL*(1 + r/12)^12N |
|
where:
|
||
| r = interest rate (for 8.25%, r = 0.0825) L = loan amount N = loan time (years) P = the monthly payment |
You are to write a program that creates the loan amounts starting at 50,000 and increasing by 50,000 to 500,000 dollars. Set the interest rate to 8% (r = 0.08), and calculate the monthly payments for 15 and 30 year Ns (loan times). Create a table that displays back to the user the loan amount, the monthly payment for 15 year and the monthly payment for 30 year loans for the initial loan values.
NOTES:
This program is different than any other you have written. There is no user
interaction with this program. You start the program, it generates the necessary
variables/arrays, runs through the calculations, and displays a table back to
the user.
This program can be implemented in a number of ways: a double (nested) loop (slowest), a single for loop with some array operations (faster), or, for the adventurous, no looping at all (fastest and most geeky!). Don't worry if you do not see how to do the last one!
Place the format statement "format bank" after clear. It will automatically make all your output to the screen have 2 decimal places
clear
format bank
REMEMBER: this program MUST adhere to the style guidelines.
Your project, should you accept it, must be e-mailed to me before the next class.