I wish I could help you, I could write this little thing as a PHP class in probably under half an hour, but I don't know java. (I have been hired twice to write java for companies as a junior programmer, both times, I converted the company to PHP, it was all web-work so it didn't really matter.)
What I would do is have the library class read in the file one line at a time.
Each line it will parse the line and create a new book class, and temporarialy hold it somewhere.
Then in that parsing function, I would create a array (or vector, as you crazy java people are prone to do) of chapter classes, and then go through and initialize each one.
After that, I would store that array of chapter classes into the book class, and add that book class (the one you were holding onto earlier, remember) to an array of books in the library class.
I wish I could help you on the vocabulary, but as I've said, I'm not a java programmer.
|