Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ My brain isn't working. Anything will go a long way thank you so much! Mortgages There are many different types of installation loans. One

C++ My brain isn't working. Anything will go a long way thank you so much!

image text in transcribedimage text in transcribed Mortgages There are many different types of installation loans. One form of loan is the mortgage. Write a program that lets the user enter the loan amount, number of years, annual interest rate and displays the amortization schedule for the loan. Suppose a loan entered by the user is $10000, the interest rate is 4%, and the duration is 24 months. The monthly payment for a given loan pays the principal and the interest. The monthly interest is computed by multiplying the monthly interest rate and the balance (the remaining principal). The principal paid for the month is therefore the monthly payment minus the monthly interest. Your program MUST use three functions. - One to read in the data from the user, - One to calculate the monthly payment - One to print the results. - A function getData called by main that takes three arguments: the loan amount, the annual interest rate, and the number of years of the loan. Call-by-reference parameters should be used to return these values. - A function monthlyPayment called by main that accepts three arguments: the loan amount, the annual interest rate, and the number of years of the loan. The monthly payment should be returned as a double. - A function display that accept four arguments: the loan amount, the interest rate, the number of months of the loan, and the monthly payment. Hint: the display function should use a loop to print the table. Since the monthly payment is the same for each month, it should be computed before displaying and passes as an argument. The balance is initially the loan amount. For each iteration in the loop, compute the interest and principal, and update the balance. Output answers in decimal form to two places. Your program should allow the user to repeat this calculation as often as the user wishes (handle both upper and lower case Y and N ). Input Validation: You must check to make sure the values entered by the user are valid. Do not accept negative values for loan amount, number of years and interest rate. Sample output: Enter loan amount: 10000 Enter number of years as an integer: -2 Invalid. Enter number of years again: 2 Enter yearly interest rate: 4 Loan Amount: 10000 Number of Years: 2 Interest Rate: 4% Monthly Payment: 434.24 Total Payment: 10422 Would you like to calculate another loan (Y or N)? n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions