{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Homework #3

# Homework #3 - MAE9 Homework#3 Fall 2008 Due on Monday by...

This preview shows pages 1–2. Sign up to view the full content.

/* MAE9: Homework #3, Fall 2008 Due on Monday, by 9pm, October 20 (a) Create a table for monthly payments of a house loans. Enter the price of a house from the keyboard, for example price = 450000. For annual interest rates: annual_rate = 0.06 to 0.08 with the increment of 0.002, compute by using the for-loop the monthly payments for 15-year, 20-year, and 30-year loans. Print the results in the table on the screen. (b) Copy the previous loop and modify it to calculate the total payments after 15, 20, and 30 years. Print results in another table on the screen. ........................................ Use the formula for equal-monthly-payments: month_pay = price * i* (1 + i)^n/((1 + i)^n - 1) where i= annual_rate/12. (monthly interest rate), and n = the total number of payments. The total payment for a given loan is: tot = n * month_pay To compute (1 + i)^n use pow(1.0 + i, (double)n) ........................................................... Your output should look like this: iacs5.ucsd.edu% gcc hw3.c -lm iacs5.ucsd.edu% a.out Enter the price (double):450000. price = \$450000.00 Monthly Payments Ann. Int. Rate 15-yr loan 20-yr loan 30-yr loan ----------------------------------------------------------------- 0.0600 3797.36 3223.94 2697.98 ...... ....... ....... .......

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}