So there are really 2 parts to this question. Let's tackle reading a text file first. Have you tried anything at all yet? My google search turned up lots of info regarding reading a text file. Check some of those out and when you get stuck you can ask a specific question in the I/O and Streams forum.
As to the second part of your question, well, why don't we just wait for that one once you get the I/O portion down. Baby steps. I'm closing this thread because any future questions will belong in different forums.