Assignment #2 Description


For this assignment you will be adding a bit more functionality to the system and modifying what you built up for the last assignment. You have three primary objectives for this assignment. They are both quite disjoint.

Objective 1 - Make SubStr4 a subclass of a base class called SubStr. It will be an abstract class. You need to decide which functions of SubStr4 are general and should also be made virtual functions of SubStr. Are there other functions that you should probably add considering that the class is going to be somewhat generic?

Objective 2 - You will write a container base class (or superclass if you prefer) for holding objects of SubStr type, SSContainer. Note that in order for this to be polymorphic the objects need to be stored as pointers. This class will be a completely abstract class. It will only have pure virtual functions in it that give the general functionality of all containers. You will then create your first subclass of this class which is a linked list class, SSLinkList. The linked list should be singly linked and dynamic. You can chose exactly how to implement it. You will need to add virtual methods to the base class and implemented methods to the linked list class that give it the ability to help you do operations on substrings. This will include at least functions to seach for given substrings and return them as well as those to add and remove them. Add a load method to the SubStrHandler class you wrote last time so that it can load the substrings into an SSContainer. For now you will use SSLinkList as the container in your testing.

Objective 3 - I'm placing a list of English words in the directory below where you are working on SnowWhite. You should write code that reads in this file and when it finds a word with 4 characters in it, it "removes" it from the substrings. Note that this can be done either with a physical removal, or with a marker to say that it is not usable, or anything else that you feel you want to do. Whatever you decide to do, make sure that it is reflected in the binary file so that you don't have to repeat this function the next time you read in the substrings.

Extension - Write another subclass of SSContainer that is an array based container. You can use vector if you wish. Implement the required methods on it. Do a small battery ot tests with both the SSLinkList and SSArray classes to see how they perform on different operations. To get timing information refer to the man page for clock.


Once again I would like the written design handed in to me. The code need only be mailed on the date it is due, but this time I would also like you to return both the original design and the revised design. It would be nice if you can make in the revised design where you made alterations. This can be done by putting in any character string that stands out. Making sure it isn't common also allows you to do a search for it before the next assignment and remove it easily. I would recommend something like "!ALTERED!" so that it is also clear to me what it means. Of course, this has to be in a comment if it is parts of your header file.