1. Member
Join Date
Mar 2011
Posts
23
Rep Power
0

Mortgage Monthly Payment Formula

Greetings Java Forums,

I have to create a method that calculates the mortgage monthly payment, using the following formula:

Loan Payment Formula

But I don't know how I'm supposed to write this in Java, specifically the power part.

How would I go about writing this formula in Java? Thanks again.

3. Member
Join Date
Mar 2011
Posts
23
Rep Power
0
Here is the formula:

4. What have you tried so far?

5. Senior Member
Join Date
Jun 2008
Posts
339
Rep Power
10
It's probably easiest to break it down into stages so you can check each stage is giving the right result, e.g. (pseudocode)
a = 1 + rate
b = Math.pow(a, months)
c = b - 1
d = rate / c
e = rate + d
f = e * principal

If that's too simple, you can combine steps together, as you see fit.

6. Member
Join Date
Mar 2011
Posts
23
Rep Power
0
Originally Posted by sunde887
What have you tried so far?
I basically typed out the formula without the power:

double monthlyInterestPayment=(0.0032 + (0.0032 / ((1 + 0.0032) - 1)) + 1800);

Originally Posted by dlorde
It's probably easiest to break it down into stages so you can check each stage is giving the right result, e.g. (pseudocode)
a = 1 + rate
b = Math.pow(a, months)
c = b - 1
d = rate / c
e = rate + d
f = e * principal

If that's too simple, you can combine steps together, as you see fit.
Thanks. I think I'll do something like that. I'll let you guys know if it works.

EDIT: Yep, it works. +rep to both of you guys.

Now I just have to figure out how to do the rest of this assignment!
Last edited by EpyonCustom; 04-28-2011 at 02:20 AM.

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•