Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose you have taken out a loan that is to be repaid, with interest, in monthly installments. The amount due each month can be determined

Suppose you have taken out a loan that is to be repaid, with interest, in monthly installments. The amount due each month can be determined using the following formula:

image text in transcribed

where

image text in transcribed = individual (monthly) payment

image text in transcribed = principle (i.e., amount of loan)

image text in transcribedi= interest rate (monthly)

image text in transcribed = number of (monthly) payment periods

a. Define a function named monthlyPayment that takes 3 arguments as input: the amount of the loan, the annual interest rate (as a percentage), and the term of the loan (number of years), in that order. The first line of the functions should look like:

function payment = monthlyPayment(principle, interest, term) 

You should assume that interest is the annual interest rate, given as a percentage (e.g., 4.75 and not 0.0475) and that term is the number of years the loan is for.

The function should return the monthly payment amount, calculated using the formula above. Note that your function will have to take into account the fact that values passed into the function are given in yearly amounts and the function needs to calculate the monthly payment. Make sure your function works correctly on vectors as well as scalars, i.e., make sure it works if principle, interest, and term are vectors containing the information for N loans (in which case it should return a vector of length N containing the monthly payment amounts).

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

Introduction To Database And Knowledge Base Systems

Authors: S Krishna

1st Edition

9810206208, 978-9810206208

More Books

Students also viewed these Databases questions