This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java in General and the fly likes Arrays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Arrays" Watch "Arrays" New topic
Author

Arrays

John Perry
Greenhorn

Joined: Oct 21, 2006
Posts: 5
Hello, i'm having problems storing data into an array. I'm trying to store strings and doubles, but the data does not get stored properly.

Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
I think you need to rethink your addScore method. There is a problem with the logic.
John Perry
Greenhorn

Joined: Oct 21, 2006
Posts: 5
I will need the method later on for validation.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by John Perry:
I will need the method later on for validation.

I think Keith is suggesting that there is a problem with the logic inside that method body -- not that the method itself shouldn't be there.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
Hi John,


your loops are nested.
Guess how many values i can have before the first return.
Here's how addScore looks, if properly indented:



Yours,
Bu.
John Perry
Greenhorn

Joined: Oct 21, 2006
Posts: 5
I have modified my code, however i do not understand why i'm getting duplicates. If i type in "Judge1" and score "10", then i type in "Judge2" and score "9", i get a duplicate:



 
GeeCON Prague 2014
 
subject: Arrays