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

2. You are going to buy a home and want to compare the difference between the mo

ID: 2264454 • Letter: 2

Question

2. You are going to buy a home and want to compare the difference between the monthly payments and the total cost of a 15 year and a 30 year fixed rate mortgage You are borrowing a principal of $150,000 to add to your $5,000 down payment (Total cost of the house is $155,000). You have secured a great interest rate of 4.25%. The monthly payment (M) is given by: 12 12y where P is the principal loan amount, r is the interest rate (in decimal form not percent form), and y is the number of years of the loan. Write an m-file that calculates the monthly payment for the loan information given for both a 15 year and 30 year payment plan. Then calculate the total cost of loan and how much more you would be paying above the loan (i.e. the cost of the load) given each payment plan. You will have six variables total. Use format bank for your numerical display (add it to your m-file) Create a new m-file. Create a principal vector P that accounts for a range of down payment amounts from $0 to $50,000 in $5,000 increments. Calculate the monthly payments (for the 4.25% interest rate) for both the 15 and 30 year payment plans. Create an array in the following format (i.e. columns) a. b. Principa 15 yr Payment 30 yr Payment Create a new m-file that will serve as a loan calculator (like the ones that you might find on-line). Request the following input from user: the total cost of the house, the down payment, the interest rate (in percent form), and the payment period (ie, # of years Calculate the monthly payment, the number of months in the payment period, and the total cost of the loan (difference between the principal and the total of all monthly payments). Then print the following statements: c. "Your total monthly payment is XX per month for XXX months." XX and XXX are your variables. blank line "You will pay YY above the principal value of the loan."

Explanation / Answer

%%% a)

clc;
clear all;
close all;
format short
%%% a)
P=150000;
r=4.25/100;
y=[15 30];
M=P*(r/12)./(1-(1+r/12).^(-12.*y));
M_1=P*(1+r/12).^(12*y);
M_2=M_1-P;
fprintf(' year Monthly Payment Total cost of loan Extra money above the loan ');
for n=1:2
fprintf(' %d %f %f %f ',y(n),M(n),M_1(n),M_2(n));
end

OUTPUT:

year Monthly Payment Total cost of loan Extra money above the loan
15 1128.417617 283442.433542 133442.433542
30 737.909837 535597.420881 385597.420881

%%% b)

clc;
clear all;
close all;
format short
%%% a)
r=4.25/100;
y=[15 30];
g=0:5000:50000;
P=155000-g;
fprintf('Principle amount 15 year payment 30 year payment ');
for k=1:length(P)
M=P(k)*(r/12)./(1-(1+r/12).^(-12.*y));
fprintf(' %d %f %f ',P(k),M(1),M(2));
end

OUTPUT:

Principle amount 15 year payment 30 year payment  
155000 1166.031537 762.506831  
150000 1128.417617 737.909837  
145000 1090.803696 713.312842  
140000 1053.189776 688.715848  
135000 1015.575855 664.118853  
130000 977.961934 639.521858  
125000 940.348014 614.924864  
120000 902.734093 590.327869  
115000 865.120173 565.730875  
110000 827.506252 541.133880  
105000 789.892332 516.536886  

c)

clc;
clear all;
close all;
format short
%%% a)
a=input('Total cost of house : ');
b=input('Down payment :');
r=input('Interest rate in persent :');
y=input('Payment period in year :');
P=a-b;
r=r/100;
M=P*r/12/(1-(1+r/12)^(-12*y));
K=P*(1+r/12)^(12*y);
A=K-P;
fprintf('Your total monthly payment is %f per month for the month %d ',M,y*12);
fprintf('You will pay %f above the principal value of the loan',A);

OUTPUT:

Total cost of house : 45000
Down payment :500
Interest rate in persent :2.5
Payment period in year :25
Your total monthly payment is 199.634447 per month for the month 300
You will pay 38582.912114 above the principal value of the loan

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