Sample Assignment: The Sequence Class with a Linked List
sequence3.h:The header file for the new sequence class. Actually, you don't have to write much of this file. Just start with our version and add your name and other information at the top. If some of your member functions are implemented as inline functions, then you may put those implementations in this file too. By the way, you might want to compare this header file with your first sequence header file (sequence1.h) , and second sequence header file (sequence1.h) . The linked list version no longer has a CAPACITY constant nor a DEFAULT_CAPACITY constant because the items are stored on a linked list instead of an array.
sequence3.cxx:The implementation file for the new sequence class. You will write all of this file, which will have the implementations of all the sequence's member functions.
sequencetest.cxx:This is the same interactive test program that you used with the earlier sequences. If you want to use it with the new sequence, then copy it to your directory and open it with your editor. Then change the statement
sequence_exam3.cxx:A non-interactive test program that will be used to grade the correctness of your new sequence class.
node1.cxx:Copy these files to your subdirectory. They contain the linked list toolkit from Section 5.2. You may use these files without changing them.
Your sequence class for this assignment will differ from the your previous sequence in the following ways:
Start by declaring the new sequence's private member variables in sequence3.h. You might try declaring these variables yourself, and then compare your solution with the suggestion in Section 5.4.
Once again, do your work in small pieces. For example, my first version of the sequence had only a constructor, start, insert, advance, and current. My other member functions started out as stubs.
Use the interactive test program and the debugger to track down errors in your implementation. If you have an error, do not start making changes until you have identified the cause of the error. If you come to me or a TA for help, we will always ask you to do the following:
For those working in the Unix operating system:
Spend some time writing your make file.
A correct Unix makefile will save you time. Make sure that
each compilation command in the make file has a TAB
as the first character. In order to insert a TAB using emacs,
type Ctrl-Q and then press the TAB key. Or, if you are working
from a modem where the TAB key is disabled, you can type
ESCAPE x quoted-insert RETURN TAB