Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MONTHLY HOUSE COSTS Write a C + + program to calculate the monthly cost of a house given the selling price, annual rate of interest,

MONTHLY HOUSE COSTS
Write a C++ program to calculate the monthly cost of a house given the selling price, annual rate of interest, and number of years for the loan. The monthly mortgage payment may be computed using the following formula:
payment = a*i(1+i)n
(1+ i)n 1 where a=amount of loan
i=rate of interest per compounding period (annual rate/12)
n=number of compounding periods (yrs*12)
Assume that the down payment will be 20% of selling price, yearly tax rate is 1.25% of selling price, utilities will be approximately $500.00 per month, and insurance will be $703.00 per year.
INPUT
In a separate function called from main() prompt the user for the selling price, the rate of interest, and the number of years for the loan.
Use preprocessor defined constants to set the tax rate, cost of insurance, and the cost of utilities. Set the percentage of down payment as a non-global memory constant in the function the value is used in.
CALCULATIONS
A function called from main() calcMonthlyCosts() is to handle all computations including invoking (calling) two other functions (which I like to term as subfunctions). See the structure chart below. calcLoanDownMortgage() is to calculate the three values: amount down (20% of house selling price), amount of loan (selling price minus amount down), and the monthly mortage using the formula above. The other function called from calcCosts() is to calculate the total of the monthly costs including mortgage payment, utilities, property tax per month, and insurance.
OUTPUT
One function called from main() is to be used to outout values input and values used in the calculations as well as the monthly payment and total monthly house cost. Output needs to be formatted as follows:
MONTHLY COST OF HOUSE
SELLING PRICE XXXXXX.XX
DOWN PAYMENT XXXXXX.XX
AMOUNT OF LOAN XXXXXX.XX
INTEREST RATE XX.XX%
TAX RATE XX.XX%
DURATION OF LOAN (YEARS) XX
MONTHLY PAYMENT
MORTGAGE XXXX.XX
UTILITIES XXXX.XX
PROPERTY TAXES XXXX.XX
INSURANCE XXXX.XX
__________
$ XXXXX.XX
STRUCTURE CHART SHOWING NECESSARY FUNCTIONS
image.png
CHECKPOINTS
Include name, e-mail, and lab# as comments at the top of your code.
Minimum of three (3) comments (including Pre/Post/Purpose) in each function other than main() and a minimum of 4 comments in main() function.
Reference parameters must be described as such. For example: void fun(double& length, ...){/*Pre: reference to length,
Use globally defined constants for property tax rate, cost of utilities, and cost of insurance. Use non-global memory constant for percent of down payment.
Use exactly one function which must be called from main() for all input.
Use C++ Style with prototype before main() and the function definition after main().
Write a calculation function (shown as calcMonthlyCosts in structure chart) which must be called from main() which handles all calculations. This function needs to contain a call to exactly two other functions. The first of these (shown as calcDownLoanMortgage in structure chart) is to calculate precisely three values: the down payment, amount of the loan and monthly mortgage payment. The second (shown as calcTotal in structure chart) is to calculate the total cost per month of owning this house.
Use C++ Style with prototype before main() and the function definition after main().
Write a function to be called from calcMonthlyCosts() function (shown as calcDownLoanMortgage in structure chart) which calculates precisely three values: the down payment, amount of the loan and monthly mortgage payment.
Use C++ Style with prototype before main() and the function definition after main().
Write a function to be called from calcMonthlyCosts() function (shown as calcTotal in structure chart) which calculates the total cost per month of owning this house.
Use C++ Style with prototype before main() and the function definition after main().
Use exactly one function which is called from main for output.
Use C++ Style with prototype before main() and the function definition after main(). Output must be formatted exactly as shown on lab write-up with decimal points lined up.
Include code to output to the screen your name AND something (JUST ONE thing) you learned from completing this lab. Be brief.
Use pass by reference where needed and only where needed.
Please include,"Minimum of three (3) comments (including Pre/Post/Purpose) in each function other than main() and a minimum of 4 comments in main() function.
Reference parameters must be described as such.

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