If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Array program help

I have to write a program that will have a gui interface, and will have a data file with information stored on it like this.
John 9503
Fred 1111
MIke 1211

Well the program will allow the user to input either the name of the person or the id # of the person. And the program will basically do a search of the file and then return either name or id depending which one was inputted by the user.

I have already set up the GUI interface for the program but I cannot figure what I need to do next to get the info from the file etc....... I do know that the information from the file has to be read into an array but I can't figure out how to get it done.
Anyone that can help. I will greatly appreciate.

You could create a FileReader object and do a line by line readout of the file.
you can then split every line you read on the space character since that seems to be the seperating char between the name and the id.
Finally you could check both the name and the id against the user input.
If you find a match you don't have to look any fuirther do you can close the reader.