aspose file tools
The moose likes Beginning Java and the fly likes I'm lost, need help figuring what todo? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "I Watch "I New topic
Author

I'm lost, need help figuring what todo?

mike statham
Greenhorn

Joined: Feb 24, 2012
Posts: 14
Been Fix thanks to you all!

Reposed the old code, after I learn I shouldn, sry agian

Manoj Kumar Jain
Ranch Hand

Joined: Aug 22, 2008
Posts: 191

what is the "key" ??


Do not wait to strike till the iron is hot; but make it hot by striking....
Marco Galea
Ranch Hand

Joined: Mar 30, 2011
Posts: 30
you haven't declared "key" anywhere in your code that's why it's throwing that error. If you want to read the nextDouble you should use the reference you created for the Scanner object i.e. "scan"



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
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 530
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 ). Repeat while lines exist in the file.

This approach works well if you're then creating objects from the data, say a Student object, in which to store the results.


Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 4756
    
    7

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.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3050
    
    1

Sorry for hijacking, but how come? I think Scanner is a wonderful class.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 5888
    
    6

Stephan van Hulst wrote:Sorry for hijacking, but how come? I think Scanner is a wonderful class.


I've just never liked the color scheme.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: I'm lost, need help figuring what todo?
 
Similar Threads
standard deviation
Not passing the value
NullPointerException
Inheritance error?
when i run my virtual machine just keeps going, but no output.