Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The monthly payments for a given loan are divided into amounts that apply to the principal and to the interest. For example: if you make

The monthly payments for a given loan are divided into amounts that apply to the principal and to the interest. For example: if you make a monthly payment of $500, only a portion of the $500 goes to the principal and the remainder is the interest payment.

? monthly interest = monthly interest rate x balance of principal

? balance of principal = monthly payment - monthly interest

? monthly payment = (monthly interest rate x balance of principal) / (1 - (1 + monthly interest rate)^-months)

Write function payments(amount, rate, months) that takes the loan amount (principal), annual interest rate (convert to monthly interest rate in the function), and loan period (in number of months) as arguments. Output (print) a summary of the loan that includes: the loan amount, total interest paid, and total paid. Calculate and write to the file payments.csv for each month, the payment number, monthly payment, interest, principal, remaining balance after the payment, and the total interest paid. (Do not import csv). For example: a loan payment schedule for a 15-year (180 months) loan of $150,000 with a 5.5% annual interest rate (.004583 monthly interest rate) is:

image text in transcribed
>>> payments (150000, 5.5, 180) Loan Summary Loan amount is $150, 000.00 Total interest is $70, 612.53 Total paid is $220, 612.53 To view monthly detail go to payments . csv 'Thanks for using the payments() function' Following is some of the data from payments.csv in Excel: A B C D E F G 1 Payment Nui Payment Interest Principal Balance Total Interest 2 1225.63 687.5 538.13 149461.87 687.5 3 1225.63 685.03 540.59 148921.28 1372.53 4 1225.63 682.56 543.07 148378.21 2055.09 5 1225.63 680.07 545.56 147832.66 2735.16 6 1225.63 677.57 548.06 147284.6 3412.72 675 05 560 57 146721 na An27 78 If you open payments.csv in a text editor, like TextEdit, the same data appears with the commas between data fields: Payment Number, Payment, Interest, Principal, Balance, Total Interest 1, 1225. 63, 687. 50, 538. 13, 149461. 87, 687.50 2, 1225. 63, 685. 03, 540.59, 148921. 28, 1372.53 3, 1225. 63, 682.56, 543. 07, 148378.21, 2055.09 4, 1225. 63, 680. 07, 545. 56, 147832. 66,2735.16 5, 1225. 63, 677.57, 548. 06, 147284. 60, 3412.72 6, 1225. 63, 675. 05, 550.57, 146734. 03, 4087.78

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

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions