ErrorReport * SpellingChecker::CheckDocument(const string & fileName) { open document file if (document file cannot be opened) throw IOException errors = new ErrorReport() int lineNumber = 0 for (each line in document) { ++lineNumber for (each word in line) { if (!dictionary->Contains(word)) { errors->AddError(word, lineNumber) } } } return errors; }