Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The monthly payment, P, of a N years mortgage of an amount L that with a yearly

ID: 3573722 • 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)^12N/(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

function rpl = loan_payment(it, p, n, y)
it = it/100;
rpl = p*((it/100*12*(1+(it/100*12)).^12*n)/((1+(it/100*12)).^12*n)-1);
end


clc; clear; close all;
y = input('Enter term in years: ');
p = input('Enter principal: ');
it =input('Enter annual interest rate: ');
n = input('Enter number of payments per year: ');

rpl = loan_payment(it, p, n, y)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote