The monthly payment, P, of a N years mortgage of an amount L that with a yearly
ID: 3573703 • Letter: T
Question
The monthly payment, P, of a N years mortgage of an amount L that with a yearly interest rate of r is given by: P = L r/100 middot 12 (1 + r/100 middot 12)^12 N/(1 + r/100 middot 12)^12N - 1 where r is in % (e.g., 7.5% entered as 7.5). Write a MATLAB program in a script file that calculates P. When the program is executed it asks the user to enter the mortgage amount, the number of years, and the interest rate. The output is displayed in the following format: "The monthly payment of a XX years XXXXXX.XX mortgage with interest rate of XX.XX percent is SXXXX.XX", where XXX stands for the corresponding quantities. Use the program for determining the monthly payment of a $250,000 mortgage for 30 years and 4.5% yearly interest rate.Explanation / Answer
Matlab Code:
clear, clc
L = input('Mortage Amount : ');
N = input('Number of years : ');
r = input('Interest rate in percent : ');
P = L * (r/1200) * (1 + r/1200)^(12*N) / ((1+r/1200)^(12 * N) - 1);
fprintf(' Monthly payment of a %i years %.2f mortgage ', N, L)
fprintf('Interest rate of %.2f percent is $%.2f ', r, P)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.