Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

Thread: New to programming and need some help

1. 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"

2. Re: New to programming and need some help

Summary of Operators and the Math class may help you get things under wraps.

3. 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)?

4. 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...