Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that calculates the total interest paid for a loan and the total amount paid at the end of the loan. Program Details

image text in transcribedimage text in transcribed

Write a program that calculates the total interest paid for a loan and the total amount paid at the end of the loan. Program Details - Ask the user to enter the following data: - the loan amount: a floating-point value between 1000.00 and 100000.00 - how many monthly payments will be made to pay off the loan: an integer value between 12 and 120 - the annual interest rate: a floating-point value between 1.60 and 18.50 - Data entered by the user must be validated. - use while loops and try/ except to verify that the data entered is of the proper data type and that it meets the given criteria - The user will be making fixed monthly payments. The monthly payments can be calculated using the following formula: monthlypayment=1(1+monthlyinterestrate)numberofpaymentsmonthlyinterestrateloanvalue For example for a loan of $1000.00 to be paid in 12 months, with an annual interest rate of 5.00%, the formula above calculates a monthly payment of 85.60748178846738 (or $85.61 when properly formatted for printing) Required Function - totalinterestPaid(loanvalue, annualRate, numberofpayments) function, where: - loanvalue is the amount of money owed - annual Rate is the the annual interest rate numberofpayments is the number of payments to be made to pay the loan in full - This function calculates and returns the total interest paid over the life of the loan - The function should perform the following steps to calculate the total interest paid: 1. Calculate the fixed monthly payment (see formula provided above) 2. As long as money is still owed: - calculate the monthly interest to be paid (based on the current loan balance and the monthly interest rate) - calculate how much of the monthly payment goes towards the loan balance (by subtracting the calculated interest from the monthly payment) - this is called the principal - update the balance owed by subtracting the principal from the current loan balance - update the the total interest paid so far

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

5. Prepare for the role of interviewee

Answered: 1 week ago

Question

6. Secure job interviews and manage them with confidence

Answered: 1 week ago