rfs02's Profile User Rating: -----

Reputation: 26 Craftsman
Group:
Contributors
Active Posts:
70 (0.1 per day)
Joined:
30-September 12
Profile Views:
1,251
Last Active:
User is offline Nov 10 2012 06:34 PM
Currently:
Offline

Previous Fields

Dream Kudos:
25
Icon   rfs02 has not set their status

Posts I've Made

  1. In Topic: Practice With Arrays!

    Posted 15 Oct 2012

    I would start at both ends of the array and swap the element at position 0 with the element at position goodies.length, then I would do the same for the elements at positions 1 and goodies.length - 1... etc....

    Make sure you stop when you reach to the middle of the array, otherwise, you'll end up reversing it again.
  2. In Topic: Practice With Arrays!

    Posted 15 Oct 2012

    View Postsepp2k, on 15 October 2012 - 11:15 AM, said:

    You can't expand arrays in Java. Note that the assignment says that the previously last element will disappear.


    I was thinking that you would have to create a new array and move all the data elements to the new array. I hadn't noticed the part of the assignment that said the last element would disappear. That's why I never did well on my assignments :)
  3. In Topic: Practice With Arrays!

    Posted 15 Oct 2012

    Let's focus on moveDown for a second.

    • You need to check if spot is within the bounds of the array, which you are not
    • goodies[i]-- decrements goodies[i], which is not what you want... You want to make goodies[i] equal to goodies[i + 1]
    • Why exactly are you decrementing spot?


    For moveUp... Same comments, but your array might become larger than the input array, so you need to expand it by one element.

    EDIT: Nevermind, the originally last element of the array can disappear as pointed out by sepp2k in the comments below, so no need to create a new array.

    And I have no idea what you are trying to do with reverser
  4. In Topic: Odd Bracket Conundrum

    Posted 14 Oct 2012

    Also, check what happens if you enter:

    -5, 1, 0

    AND - what happens if you just enter 0
  5. In Topic: insertion into an array.

    Posted 14 Oct 2012

    Without seeing your whole code, it's hard to tell what would happen.

    Try it and see what happens. If you still have trouble, reply to this thread with what the problem is.

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

rfs02 hasn't added any friends yet.

Comments

rfs02 has no profile comments yet. Why not say hello?