This website is preserved for historical and scholarly reference and is no longer actively maintained.
                         CpSc 241, Section 1
                             Assignment 6
                           23 February 2000


Due: Wednesday, March 8, at midnight 

Late penalties: 20 points per partial day late.  That is, programs
	turned in after midnight Wednesday and before midnight Thursday
	will have 20 points deducted for late, programs turned in after
	midnight Thursday and before midnight Friday will have a total
	of 40 points deducted for late, etc.

Total point value of assignment:  100 points

Late submissions not accepted after: Sunday, March 12 at midnight

This assignment is to be done INDIVIDUALLY.


Create a directory, A6, which will contain all parts of this assignment.
You will need the has function code from Figure 5.4 on page 183 (A good 
hash function), class ListNode, class ListItr, class List  and the code
for the separate chaining hash table from the text. 
You will also need

	a6.cpp (your main program)  

The objectives of this program are to give you experience with
using a hash table and to create code that will be useful for a
programming project later in the semester.

The main() will be called a6.cc or a6.cpp, whichever you choose.  You will
also use an input file named a6.dat.  Submit all files in your directory
A6 using handin.


Requirements:

You are to read strings from an input file and count the number of
distinct strings read.  To each string you are to associate a
unique integer, which represents the order in which the string was
first encountered.  For example, if the input is:

	while
	if
	else

the integer 1 will be associated with while, 2 with if, and 3 with
else.  The string and its associated integer are to be stored in
a hash table using separate chaining.  (You will need to make a
change in class ListNode.  Examine other methods to see if anything
needs changing.)

If the string read already exists in the hash table, go on to the
next string without creating an entry or assigning a number to the
string.  For example, if the input is:

	for
	else
	for
	while
	else


the integer 1 will be associated with for, 2 with else, and 3 with
while.  You will need to include a method, printHash to print
the hash table.  

Your main program should print each string as it is read from the
file and, if a number is assigned to the string, print the number.
Before your main program terminates, printHash should be called
to demonstrate that your program works correctly.
	

Other requirements:

	Your program should print to the screen:

		Your name
		The Assignment Number
		A short description of the assignment

	before any other part of the program.  You may want to 
	have a question asking the user if s/he is ready to continue
	so that this information will stay on the screen until
	the grader is ready to test your program.

	Follow the style standards to be found from your instructor's
	web page for CPSC 241.


Grading rubric:

	Style standards, including required documentation 20 pts.
	Program compiles without errors.  10 pts.

	If the the program does not compile without error, no further points
		will be awarded.

	Reads and prints strings correctly from a6.dat. 10 pts.

	Correctly assigns integers to strings from a6.dat contained
		in programmer-supplied directory. 15 pts.

	Correctly assigns integers to strings from a6.dat provided
		by grader. 15 pts.

	Prints hash table with correct entries from a6.dat contained
		in programmer-supplied directory. 15 pts.

	Prints hash table with correct entries from a6.dat provided
		by grader.  15 pts.