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


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: New to programming and need some help

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: New to programming and need some help

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

  3. #3
    Member
    Join Date
    Oct 2012
    Posts
    38
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default 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. #4
    Member
    Join Date
    Jun 2012
    Posts
    41
    Thanks
    0
    Thanked 1 Time in 1 Post

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

Similar Threads

  1. Blackjack programming error (programmer is new to programming)
    By JSingh in forum What's Wrong With My Code?
    Replies: 4
    Last Post: September 27th, 2012, 09:13 PM
  2. android programming vs game programming using java
    By vgoel38 in forum Android Development
    Replies: 4
    Last Post: September 8th, 2012, 05:48 PM
  3. Replies: 0
    Last Post: December 12th, 2011, 03:17 PM
  4. New to programming
    By Cranky in forum What's Wrong With My Code?
    Replies: 7
    Last Post: August 22nd, 2011, 09:41 AM
  5. [SOLVED] New to Programming
    By Delacratic in forum What's Wrong With My Code?
    Replies: 7
    Last Post: February 8th, 2011, 02:45 PM