Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please make answer clear and explain steps also please and be able to copy paste : Objective: Functions, math and file stream modules, fundamental programming

Please make answer clear and explain steps also please and be able to copy paste :

Objective: Functions, math and file stream modules, fundamental programming and problem solving Loan Calculator: Interest on a loan is paid on a declining balance, and hence a loan with an interest rate of, say, 14 percent can cost significantly less than 14 percent of the balance. Write a program that takes a loan amount and interest rate as input and then outputs the monthly payments and balance of the loan until the loan is paid off. Typically, the monthly payments are calculated using the amortization equation as follows:

= (times) (((1 + )^) / ((1 + )^ 1))

Where: M = monthly payments M = ? P = the principal loan amount P = 20000 ----> $20000 loan desired r = monthly interest rate (annual interest rate / 12) For 10% interest rate variable r would be 0.1/12 per month ---> r ~= 0.0083333 n = number of payments over loans lifetime in months (e.g., loan years * 12) 2 years loan *12 is 24 month ---> n = 24

Any monthly payment amount more than the interest is credited toward decreasing the balance due. On a loan of $20,000, the payments would be fixed at $922.90 a month. M = $922.90 Assuming an interest rate of 10 percent, then each month the interest accounts for portion of the monthly payment and the remaining portion of the payment would go towards the balance owing. The first month, (10 percent of $20,000)/12, or $166.67, would be paid in interest, and the remaining $756.23 would decrease the balance to $19,243.77. Month 1 Payment = $922.90 Interest = $166.67 principal = $756.23 Balance = 19,234.77 For month 2, the interest would be (10 percent of $19,234.77)/12, and the program continues till the 24 month is over. Your program should output to a file as well display on the screen a table that shows the interest and principal portion of the loan for every month as well as the total interest paid up to that month and the remaining balance. Finally the program output the total interest paid over the life of the loan like follows: Payment Every Month $922.90 Total of 24 Payments $22,149.56 Total Interest $2,149.56 Your program should allow the user to repeat this calculation as often as desired.

Functions that are needed to run the program: - A function that calculates and returns amortization, M using inputs of P, r, and n. This can be a call-by value function - A function that calculates the interest and balance for every month. This can be a call-by reference function. - A function that keeps track of total payment and total interest accumulated. This can be a call-by-reference function. - An input function which prompts and fills the input with values for P, r and n. This is a call by reference function. - An output function which displays the table to the screen and writes it to a file.

Sample table for amortization of a loan: Image source: https://www.calculator.net/

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_2

Step: 3

blur-text-image_3

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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

List three causes of a favourable materials price variance.

Answered: 1 week ago

Question

2. What process will you put in place to address conflicts?

Answered: 1 week ago