Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Required Function totalInterestPaid (loanValue, annualRate, numberOfPayments) function, where: loanValue is the amount of money owed annualRate is the the annual interest rate numberOfPayments is the

Required Function

totalInterestPaid(loanValue, annualRate, numberOfPayments) function, where:

loanValue is the amount of money owed

annualRate 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:

Calculate the fixed monthly payment (see formula provided above)

As long as money is still owed:

1. calculate the monthly interest to be paid (based on the current loan balance and the monthly interest rate)

2. 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

3. update the balance owed by subtracting the principal from the current loan balance

4. update the the total interest paid so far

Please use these functions and variable namesimage 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)

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

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions