also i don't actually get the use of the do-while in the first place. i think you could have done for example
but you'll still will have a problem cause you need to advance the scanner to the next new line and calculate the average for each "person" and print
This approach works well if you're then creating objects from the data, say a Student object, in which to store the results.
Greg Brannon wrote:You may want to scan each whole line from the file as a single String object, split() the line into an array of String objects at the " " (space), then parse the resulting String objects into the desired forms ( String, Double, Double, Double ).
Totally agree. I dislike Scanner intensely.