CSE 373 Spring 2005

Homework #2

Spell Checker (II)

April 8, 2005

Due:

electronically Thursday, April 14, 8:00 pm; paperwork at beginning of class Friday.

Objectives

Description

In this exercise you will expand on your previous solution to display and spell-check a document.  As usual, you will have to write certain test and driver code, as well as preparing a short report on your results.  In addition (and not related to the programming), work out the answers to some pencil-and-paper questions.

The main differences compared to the previous version, from a user viewpoint, are:

Most of the specification details can be gleaned by studying the code and comments in the starter code provided.  Read the comments carefully, as some things have changed.  The code is divided now between three packages.  As before, implement classes MySpellChecker and TestSpeller TestSpellChecker (put them in package WordPro2Speller) and MyDocument  and TestDocument (in WordPro2Document); note the constructors have changed, and there is no starter code for them.  Also complete the implementation of DocumentViewer and SpellerViewer.  WordProStarter contains the main method. You will find other required code mentioned in the files and elsewhere in this write-up.  

Among the files you will find a large spelling dictionary, linuxwords.txt.  Your program should be able to handle this file.

Do not panic about reading in data from files!  There is a handy method in the FileUtilities373 class which should make it fairly painless.  You are not required to use that method if you know another way.

Just as before (and always): You must use the exact names for classes and methods as specified here and in those files.   You cannot declare a constructor except the one mentioned in the interface comments.  You cannot create additional .java files.   You may not modify any interfaces in this or other assignments (you can't turn in modified versions).  None of your methods should require any user input of any kind, or any data files (this will change in later versions of the program). You can have additional helper methods as needed; ordinarily these should be private.  You can define additional classes but only if they are internal to the specified .java files.

Last time I didn't feel it needed to be mentioned, but this time let me stress that one does not declare non-public public instance variables except in quite exceptional circumstances (such as static finals, i.e., true constants).  If you feel you need any public data, you had better talk to me or the TAs so we can talk you out of it.

You only need very simple graphics for this project.  If you haven't worked with Java's Swing/AWT components's before, this will give you a chance to get familiar with them.  As with so many things, there is a basic structure that has to be understood, and it is not necessarily intuitive.  Some of the starter code files contain the basic structure, along with comments to help you understand it if this is your first time using Swing.

As before (and always): For this and any other assignment in CSE373, you are free to use any standard Java library class, and to use any method of those classes (unless there is some explicit instruction to the contrary).   Getting familiar with the standard Java libraries is an essential skill for today's Java programmers.  You should not use any library, class, or code aside from this (for example, something you found on the Internet or written by someone outside the class).

For this particular assignment, each student should work alone, without seeing each other's code.  In some future projects we may pair you up to work together.

You may have used JUnit in the past.  Although this assignment involves writing a test method, you won't use JUnit for it (you will in a later assignment).  Instead, expand and improve the classes TestSpeller TestSpellChecker and TestDocument.  In particular, make the main method of TestSpeller TestSpellChecker as complete and thorough a test of the Speller as possible.  It should be able to detect if there is any error in any implementation of ISpellChecker, not just yours.  TestDocument should also be expanded, but it won't be weighted as much in the grading.

Getting Started:

Pencil and Paper Homework:

From the textbook: Ch. 3, problems R-3.2, R-3.3, R-3.6 (use induction to prove the answer), R-3.8, and this problem: 

Give an example of each of these situations (the answer should be non-trivial, i.e., not the empty set), or explain why the situation is impossible:

Your answers may be handwritten as long as they are legible.

Turn in:

Electronically: seven .java files: .  Click here to turn in.  Recommendation: turn in early and often!
On paper: a printed copy of the "receipt" from your turn-in, which automatically includes printouts of the .java files.  Plus the pencil-and-paper answer, plus: a short report which

Grading

Most of the grading points will come from
Good luck and have fun!


Notes
If you have questions along the way, either about the assignment or how to do things, feel free to discuss it on the Message Board (when it is operational!).  Just don't give away code, or any crucial aspects of the solution.  It is perfectly OK to share insights about using the Java libraries.

Where applicable, write your code to be reusable and modifiable.  In a later homework, you might in fact have an opportunity to reuse or modify code from this one...