Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( 8 points ) The monthly payment M of a loan of amount P for N years and an annual interest rate r ( in

(8 points) The monthly payment M of a loan of amount P for N years and an annual interest
rate r(in %) can be calculated by the formula:
M=Pr12001-(1+r1200)-12N
(1) Write a MATLAB user-defined function (named amort) that calculates the monthly
payment of a loan. The input arguments of the function are P(the loan amount),r(the
annual interest rate in percent), and N(the length of the loan in years). You can assume
that all the input arguments are single-valued.
(2) Write a MATLAB script file that
a) prompts the user to enter a value for the loan amount, a value for the annual interest
rate in percent, and a value for the length of the loan in years
b) calls the amort function to calculate the monthly payment
c) prints the calculated monthly payment on the command window as follows:
The monthly payment is $x.
where x is the calculated monthly payment amount with two digits after the decimal point.
For example, if the user enters 260000 as the loan amount, 6.75 as the interest rate (in
percent), and 15 as the length of the loan (in years), you program should output the
following to the command window:
The monthly payment is $2300.76.
What to submit for this question: Please submit a plain text file (named a4q4.txt) that
contains the contents of both the function file and the script file.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

Describe the parts of the self, according to William James.

Answered: 1 week ago

Question

State the importance of control

Answered: 1 week ago

Question

What are the functions of top management?

Answered: 1 week ago

Question

Bring out the limitations of planning.

Answered: 1 week ago

Question

Why should a business be socially responsible?

Answered: 1 week ago