Program / Task Name:

   Compound Interest




Point Value:




Task Description

You have just graduated from college with a degree in Computer Science and youíve landed a GREAT job as a developer at Hewlett-Packard.  Only problem is, you donít have a car to get back and forth from work.

Write a program to determine your monthly car payment.  The formula for determining the monthly payment of a loan is:

P = L[c(1 + c)n]/[(1 + c)n - 1]

P = monthly payment
L = loan amount in dollars
n = number of months for the loan
c = the monthly interest rate (for example, if the yearly interest is 6%, c is 0.06/12 or 0.005)

Program Input

Your program should prompt for the cost of the car (an integer value), down payment (an integer value), yearly interest rate (a decimal value), and number of months for the loan (an integer value).


Enter the cost of the car: 25000

Enter the down payment: 5000

Enter the yearly interest rate: 5.9

Enter the number of month for the loan: 48

You can assume that none of the integer values entered will be 0 (maybe you can convince the Bank of Mom and Dad to give you one of those special 0% interest loans).

Program Output

Output the monthly payment for the loan to the screen.

Your monthly car payment is: $xxx.xx


  (c) 2004 Hewlett-Packard Company