[CSC 204] Just for grins.... to get ahead...

Andrew J. Pounds pounds_aj at mercer.edu
Fri Nov 21 19:06:09 EST 2014


You can go ahead and test out the following if you like.   Create for 
yourself an object to hold your words (don't worry about the internal 
arraylist yet -- you can add that and any other instance variables and 
methods you want later). Maybe something like...

class WordEntry {

     /* Instance Variables */
private Stringword;

     /* Zero argument constructor */
     public WordEntry ( ) { this.word = ""; }

     /* Constructor with a single argument - the word */
     public WordEntry ( String word ) { this.word = word; }

     /* A method to return the word */
     public String getWord(){ return word; }

}

and then try to combine it with the Parser I gave you to create an 
ArrayList of ALL the words as WordEntry objects (you can even have them 
multiple times in the same ArrayList).   Test by printing the 
WordEntries in the ArrayList (assuming you have enough memory). Then use 
the Comparators we talked about in class today to try and sort all the 
words alphabetically.  If you can put these pieces together you will 
have made significant progress on getting this assignment done.

As always, let me know where you are getting stuck.

-- 
Andrew J. Pounds, Ph.D.  (pounds_aj at mercer.edu)
Professor of Chemistry and Computer Science
Mercer University,  Macon, GA 31207   (478) 301-5627
http://faculty.mercer.edu/pounds_aj

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://theochem.mercer.edu/pipermail/csc204/attachments/20141121/d1edbe02/attachment.html>


More information about the csc204 mailing list