rfs02's Profile
Reputation: 26
Craftsman
- Group:
- Contributors
- Active Posts:
- 70 (0.27 per day)
- Joined:
- 30-September 12
- Profile Views:
- 747
- Last Active:
Nov 10 2012 06:34 PM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 25
Posts I've Made
-
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. -
In Topic: Practice With Arrays!
Posted 15 Oct 2012
sepp2k, 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
-
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 - You need to check if spot is within the bounds of the array, which you are not
-
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 -
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.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
rfs02 has no profile comments yet. Why not say hello?