Cactus Game Design Message Boards
Open Forum => Off-Topic => Topic started by: Humza313 on April 12, 2016, 07:23:06 PM
-
Write a method that takes an array of Object as parameter, and
reverse the array.
Hints:
• Declare the method as static since we want to test this method by
main method. Method main is static and can only call static methods
directly.
• We do not need to return anything, the change applies to the array
parameter.
• A possible way to reverse an array is to use two ends, one starts from
the leftmost index the other starts from the rightmost index, then we
swap these two elements, afterwards, move the leftmost index one
step to the right, and move the rightmost index one step to the left,
continue the above procedure until both ends meet.
-
So, i have very limited java experience, but i'll take a look at it and help as much as i can. my real question is why are you posting this on the Redemption Message Boards? are you at the wrong place?
-
I actually posted it on programming forums, but my godfather also told me to put it up here as well.
thank you
-
Oh, ok, i'll see what i can do.
-
I actually have two questions posted, the second one is the more difficult one.
-
I'm confused by the "urgent help" part. What is this for?
-
An assignment i need help on which is due at 9
-
An assignment for what? Is it an assessment?
-
assignment which will be graded.
-
Hmm, if its due at nine, i might not be able to help, i have some stuff i got to do, sorry. if you still need help with anything tomorrow, pm me and i'l see what i can do. Good luck!
-
assignment which will be graded.
Then it is inappropriate for you to be asking other people to do your assignment for you. When was this assignment given, and for what level of education is it for?
-
Why are you turning to a gaming and product forum for coding help? Lol
-
Why are you turning to a gaming and product forum for coding help? Lol
He answered that above, actually. I guess I may have been a bit harsh. I admit that I am biased since I was a virtual school teacher for a little while, but it always irked me when students would cut and paste answers from message boards and "tutoring" sites (not that Humza was going to do that). I guess it still hits a nerve. Sorry about that. :-\
-
Why are you turning to a gaming and product forum for coding help? Lol
He answered that above, actually. I guess I may have been a bit harsh. I admit that I am biased since I was a virtual school teacher for a little while, but it always irked me when students would cut and paste answers from message boards and "tutoring" sites (not that Humza was going to do that). I guess it still hits a nerve. Sorry about that. :-\
Oops, only read the first message.
-
I'll do my best to answer without just giving a cut and paste answer. Hopefully it isn't too late for you if you haven't finished it. As others have said, this isn't the best place to post questions to programming assignments. Don't worry about it now, but in the future it will probably be better to just post it on a different forum that is dedicated to computer programming.
A static method is one that simply one that is constant between all instances of an object, and thus cannot use any variables that are local to that object. To make a method static, you just have to put the word "static" before the return type of the method.
As what you posted says, you can make a loop that goes up to half way through your array. At every iteration you have to swap the ith element with the (i - 1)th element.
I'll leave the details up to you. Hope that helps you, again, if it's not too late.