Quote:

Write an application that uses interactive input to help a home buyer calculate

her expenses for buying and maintaining a house. The program asks the user

to type the following input values:

• the price of the house

• the down payment on the loan for the house

• The number of years for repaying the loan.

• the monthly utility expenses

In response, the application prints

• The monthly expense of keeping the house. (Note: this amount does not

include the down payment.)

• The annual expense of keeping the house. (Again, exclude the down pay-

ment.)

• The total expense of keeping the house for the number of years needed to

repay the loan. (Include the down payment in this amount.)

The application does not worry about inﬂation costs in its calculations.

Use this formula to compute the monthly payment on the loan for the house:

payment = {(1 + i)Ey∗ p ∗ i}{(1 + i)Ey− 1) ∗ 12} where y is the number of years

for repaying the loan, and p is loan’s principal, that is, the price of the house

minus the down payment.