Comic Book Plus Forum

All And Everything => General Discussion => Topic started by: srca1941 on April 26, 2009, 08:45:13 PM

Title: ***URGENT*** Java programming help needed tonight!!!
Post by: srca1941 on April 26, 2009, 08:45:13 PM
Nothing to do with comics, but I'm desperate and trying several different boards where I think there might be folks who can help me. If there is anyone here familiar with Java, I urgently need help for my programming class. My professor gave me a take home test, but three of the four parts deal with arrays, which he only briefly covered, and what he asks for on the exam, he didn
Title: Re: ***URGENT*** Java programming help needed tonight!!!
Post by: John C on April 26, 2009, 09:23:37 PM
It's been a few years since I've done any Java work, but most languages work the same, so I think we're safe.  Still, assuming I'm rambling incoherently and testing everything I suggest wouldn't be the worst idea in the world...

The big operator for arrays is indexing.  If you have an array A with five integers, then you have five elements:  A[0], A[1], A[2], A[3], A[4]; each of these acts just like a normal integer (or whatever) variable (or object).  Your FOR loop (in getTotal) is giving you the indices in order.  From there, adding them should be obvious and averaging them the same...but if it isn't, I should be checking e-mail on and off for another half hour or so and my direct address should be accessible over to the left.