# New to programming and need some help

• October 8th, 2012, 06:27 PM
Silversurfar
New to programming and need some help
Hey guys, im pretty new to programming, and I just cant figure out how to put this formula into java.

I just cant figure this bastard out, any ideas?

M= p[i(1+i)n ] / [(1+i)n -1]

btw n, would be "to the power of n"
• October 8th, 2012, 07:09 PM
jps
Re: New to programming and need some help
Summary of Operators and the Math class may help you get things under wraps.
• October 9th, 2012, 11:08 AM
Fazan
Re: New to programming and need some help
Typically, when you're trying to indicate you have one item "to the power of" another, you use the ^ sign. Also, when you have only letters, it's useful to include * signs for multiplication. So, correct me if I'm wrong, but are you asking how to do M = p*(i*(1 + i)^n)/((1 + i)^n - 1)?
• October 16th, 2012, 03:16 PM
lightOfDay
Re: New to programming and need some help
I believe that is what he means. The only thing you have to change from M = p*(i*(1 + i)^n)/((1 + i)^n - 1) is that instead of x^n you have to make it Math.pow(x, n), because in Java x^n means x XOR n. Java should implement the ** operator like Python...