Cactus Game Design Message Boards

Open Forum => Off-Topic => Topic started by: Humza313 on April 12, 2016, 07:23:06 PM

Title: Java Help Urgent Programming help Need Now
Post 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.
Title: Re: Java Help Urgent Programming help Need Now
Post by: Ironisaac on April 12, 2016, 07:45:57 PM
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?
Title: Re: Java Help Urgent Programming help Need Now
Post by: Humza313 on April 12, 2016, 07:47:32 PM
I actually posted it on programming forums, but my godfather also told me to put it up here as well.

thank you
Title: Re: Java Help Urgent Programming help Need Now
Post by: Ironisaac on April 12, 2016, 07:48:22 PM
Oh, ok, i'll see what i can do.
Title: Re: Java Help Urgent Programming help Need Now
Post by: Humza313 on April 12, 2016, 07:49:26 PM
I actually have two questions posted, the second one is the more difficult one.
Title: Re: Java Help Urgent Programming help Need Now
Post by: YourMathTeacher on April 12, 2016, 07:54:41 PM
I'm confused by the "urgent help" part. What is this for?
Title: Re: Java Help Urgent Programming help Need Now
Post by: Humza313 on April 12, 2016, 07:56:18 PM
An assignment i need help on which is due at 9
Title: Re: Java Help Urgent Programming help Need Now
Post by: YourMathTeacher on April 12, 2016, 07:56:56 PM
An assignment for what? Is it an assessment?
Title: Re: Java Help Urgent Programming help Need Now
Post by: Humza313 on April 12, 2016, 07:57:44 PM
assignment which will be graded.
Title: Re: Java Help Urgent Programming help Need Now
Post by: Ironisaac on April 12, 2016, 07:58:17 PM
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!
Title: Re: Java Help Urgent Programming help Need Now
Post by: YourMathTeacher on April 12, 2016, 07:59:52 PM
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?
Title: Re: Java Help Urgent Programming help Need Now
Post by: Daniel on April 12, 2016, 08:29:23 PM
Why are you turning to a gaming and product forum for coding help? Lol
Title: Re: Java Help Urgent Programming help Need Now
Post by: YourMathTeacher on April 12, 2016, 08:35:45 PM
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.  :-\
Title: Re: Java Help Urgent Programming help Need Now
Post by: Daniel on April 12, 2016, 08:58:21 PM
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.
Title: Re: Java Help Urgent Programming help Need Now
Post by: kram1138 on April 12, 2016, 10:42:29 PM
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.
SimplePortal 2.3.3 © 2008-2010, SimplePortal