Advertisement
rebbybear

Lab 5

Nov 18th, 2015
520
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. CIS 22A
  2. LAB #5
  3.  
  4. MONTHLY HOUSE COSTS
  5. Write a C++ program to calculate the monthly cost of a house given the selling price,
  6. annual rate of interest, and number of years for the loan. The monthly mortgage payment
  7. may be computed using the following formula:
  8.  
  9. payment =
  10. a*i(1+i)^n / (1 + i)^n – 1 where a=amount of loan
  11. i=rate of interest per compounding period
  12. (annual rate/12)
  13. n=number of compounding periods (yrs*12)
  14.  
  15. Assume that the down payment will be 20% of selling price, yearly tax rate is 1.25% of
  16. selling price, utilities will be approximately $300.00 per month, and insurance will be
  17. $550.00 per year.
  18.  
  19. DATA
  20. Use preprocessor statements to set the tax rate, cost of insurance, and the cost of utilities.
  21. Set the percentage of down payment as a non-global memory constant. Prompt the user
  22. for the selling price, the rate of interest, and the number of years for the loan.
  23.  
  24. CALCULATIONS
  25. Use at least four functions in addition to main: a function to input all data, a function
  26. which handles all computations including invoking a subfunction to compute the down
  27. payment, amount of loan, and mortgage payment, and, finally, one to output the results.
  28.  
  29. OUTPUT
  30. All values input and used in the calculations as well as the monthly payment and total
  31. monthly house cost need to be output as follows:
  32. MONTHLY COST OF HOUSE
  33. SELLING PRICE $XXXXXX.XX
  34. DOWN PAYMENT XXXXXX.XX
  35. AMOUNT OF LOAN XXXXXX.XX
  36. INTEREST RATE XX.X%
  37. TAX RATE XX.X%
  38. DURATION OF LOAN (YEARS) XX
  39. MONTHLY PAYMENT
  40. MORTGAGE XXXX.XX
  41. UTILITIES XXXX.XX
  42. PROPERTY TAXES XXXX.XX
  43. INSURANCE XXXX.XX
  44. __________
  45. $ XXXXX.XX
  46.  Theme issue
  47. Functions, sub-functions, pass by reference
  48.  Checkpoints
  49. 1) Include name, e-mail, and lab# as comments in the code and also include code
  50. to output this information to the output.
  51. 2) Minimum of three (3) comments (including Pre/Post) in each function.
  52. 3) User defined constants for property tax rate, cost of utilities, and cost of
  53. insurance. Use non-global memory constant for percent of down payment.
  54. 4) Use exactly one function separate from main for input.
  55. 5) Call a calculation function from main which handles all calculations. This
  56. function needs to contain a sub-function to calculate the down payment, amount
  57. of the loan and monthly mortgage payment.
  58. 6) Use exactly one function separate from main for output.
  59. 7) Output must be formatted exactly as shown on lab write-up with decimal points
  60. lined up. Output must go to a file and that file must be uploaded as .txt. No cout
  61. object should be left in this function.
  62. 8) All functions (other than main() & your signature function) must use prototype
  63. style.
  64.  Test data (see bankrate.com or use Excel & pmt()to check your answers)
  65. Set 1 – $600,000, 5%, 20
  66. Set 2 – $400,000, 4.2%, 30
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement