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

In matlab create a while loop for the following : A) Suppose that Gomez takes ou

ID: 2081667 • Letter: I

Question

In matlab create a while loop for the following :

A) Suppose that Gomez takes out a loan for $22,000 to buy a new SUV (after trading in his car). The bank charges 6% annual interest on the unpaid balance, compounded monthly (that's 0.5% interest each month). If Gomez pays $300 at the end of each month, how many months will it take him to pay off his loan? What is the amount of his last payment? His last payment will just cover the unpaid balance so will likely be less than $300. B) If, in writing a while loop to solve this problem you accidentally typed 220000 (rather than 22000); i.e., you added an extra zero to the loan amount. Explain what would happen. If you don't know what would happen, try it out.

Explanation / Answer

MATLAB CODE:-

clc
clear
A = input('Enter Loan Amount = ')
I = 0.005; % Interest per month compunded
P = A;
n=0;
while(P>0)
A1 = P*(1+0.005)^1;
A2 = A1 - 300;
P = A2;
if(P>0)
n=n+1;
Af = P;
end
end
display('No.of Months required to pay off the loan ')
n
display('Last month payment is ')
Af

OUPUT :-

Enter Loan Amount =
22000

A =

22000

No.of Months required to pay off the loan

n =

91

Last month payment is

Af =

173.2768

-------------------------------------------------------------------------------------------------------------------------------------------------------

b)

Now if we enter 220000 instead of 22000 then the repayment time will increase and money need to pay also increases.

I try to run this it takes so much time to execute.

OUTPUT :-

Enter Loan Amount =
220000

A =

220000

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