CSC 222: Computer Programming II
Spring 2005

HW3: Files, Searching & Spelling

Most word processors have the ability to scan a document and compare each word with a stored dictionary. When a word is encountered that does not appear in the dictionary, the user is notified and has the option of changing the spelling of the word, ignoring the word, or adding that word to the dictionary for future reference. This assignment involves augmenting the simple spell-checker program that was studied in class. Your improved spell checker should prompt the user each time an unknown word is encountered, and allow them to either 1) ignore that occurrence of the word, 2) ignore that and subsequent occurrences, or 3) add the word to the dictionary. After processing the entire file, the dictionary should be written back out to the same file only if it has been updated.

Note: your program need not provide the option of fixing misspelled words in the text. For EXTRA CREDIT, you can add this non-trivial feature to the program.

To complete this augmentation, first update the Dictionary class to have the following methods:

Once you have updated and tested the Dictionary class, update the main method in the SpellChecker class so that it prompts the user with each misspelled word and provides the three options described above. User interaction can be performed using the console window, or you might consider looking at the showOptionDialog method of the JOptionPane utility class.