22C:21 Project 1 Guide

This is a sequence of 5 steps you might want to take to completing Project 1. At the end of each step you will have a program (or programs) that compiles and correctly does what is expected in that step. You are not required to follow these guidelines, but I believe that following these will help you complete your project more quickly.

The grading of Project 1 will follow these rules:

The sequence of 5 steps

  1. Solve Problem 1 in Problem Set 6. This is the beginning of the program SpellCheck.java.

  2. Write a program that reads a text file (for example, one of the novels made available for Project 1) and produces as output a list of all distinct words in the file. The output should be written into a file called words.dat and should contain one word per line. With minor changes, you can use the classes Record.java and DynamicRecordDB.java as the data structure for storing and searching for words. This is the beginning of the program BuildDict.java.

  3. Extend the program written in Part 2 to be able to read from multiple text files (as described in Project 1). Now the program has exactly the functionality of buildDict.java, except that it is not using a hash table to store and search for words. Extend the program written in Part 1 to (i) read the list of words stored in words.dat into a data structure, (ii) read a text file and check for words that are mispelled, and (iii) output the text file with each mispelled word flagged with a "*" following it. In this step, you can use the classes Record.java and DynamicRecordDB.java as the data structure for the spell checker. Also, make sure that if the name of text file that you are spellchecking is "foo" then the output is "foo.out." At this stage we have a program that builds a dictionary and a program that checks spellings.

  4. Now replace the DynamicRecordDB.java data structure by a hash table in buildDict.java as well as in spellCheck.java. Use hashing with chaining, as described in Project 1 handout. You will have to slightly modify Lafore's linked list classes, Link.java and LinkList.java, for this. Basically, the Link class needs to change so that each Link object consists of a String and a pointer to the next Link. Also, extend the functionality of the spelling checker to interact with the user as described in Project 1 handout. Do not bother to implement the P and N prompts at this stage.

  5. Finally, implement the P and N prompts also. This will involve modifying the hash table data structure to accomodate a record with two strings. Again, it is the Link class that needs to change so that each Link object consists of two String objects and a pointer to the next Link.

Additional Information: Based on questions that students have asked me and the TAs, here are some additional notes on Project 1.