[SOLVED] Maple Programming (1)

I'm not sure this is the proper place to post this, but I may have Maple programming questions in the future...where should I post them?

I'm taking a math class where Maple programming is taught. I love the class, and I'm currently working on the first assignment, but I just want to make sure I interpreted the question properly and coded this correctly.

Here is the question.

**A mortgage problem** Let $$\displaystyle A$ be the amount of a mortgage, $\displaystyle n$ the total

number of payments, $\displaystyle i$ the interest rate per period of payment. Then the

mortgage payment $$\displaystyle R$ per period is given by the formula:

$\displaystyle R =\frac{A i}{1 - (1 + i)^{(-n)}}$.

• Write a program that, for input: $\displaystyle p$, $\displaystyle r$, $\displaystyle y$, $\displaystyle d$ as price of the purchase,

annual percentage interest rate, number of years, and down payment

percentage respectively, calculates and prints the monthly payment

amount.

The only thing I wasn't sure about was how to apply the initial down payment. I took a guess at it, and this is how I programmed it:

Code:

`mortgage := proc(p,r,y,d)`

local mon_pay, in_down; # Declaring Local variables for initial

# down payment and monthly payment

# Defining in_down

in_down := evalf( p * d ); # initial down payment with a rate of d%

# Defining mon_payment

mon_payment := evalf( in_down + ( (p*r) / (1-(1+r)^(-y) ) );

# Display monthly payment

return mon_payment;

end proc;

Does this look right to you?

Thanks for any input! :D

--Chris