Write a program that checks the spelling of all words in a file. It should read each word of a file and check whether it is contained in a word list. A word list is available on most UNIX systems in the file /usr/dict/words. (If you don't have access to a UNIX system, your instructor should be able to get you a copy.) The program should print out all words that it cannot find in the word list.

Complete the following files:


import java.io.FileNotFoundException; import java.io.File; import java.util.Scanner; /** This program runs a spell check. */ public class SpellCheckRunner { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(System.in); System.out.println("Word list file: "); String dictionary = in.nextLine(); Scanner dictIn = new Scanner(new File(dictionary)); SpellChecker checker = new SpellChecker(dictIn); dictIn.close(); System.out.println("File to check: "); String filename = in.nextLine(); . . . } }


import java.util.ArrayList; import java.util.Scanner; /** A class to check the spelling of words. */ public class SpellChecker { /** Construct a SpellingCheck object. @param in the scanner containing a list of properly spelled words */ public SpellChecker(Scanner in) { . . . } /** Checks if a word is in the word list (ignoring letter case and punctuation) @param word the word to check for @return true if word was found, false otherwise */ public boolean check(String word) { . . . } }