Posted: | Monday, 11/25/02 |
Design Document Due: | No Design Document |
Project Due: | Before midnight, Tuesday 12/10/02
NOTE - this due date is two days more than the usual two weeks because of the Thanksgiving holiday. Students are encouraged to submit assignments earlier than 12/10 to have sufficient time to study for finals. The first day of finals (including Mr. Raouf's final) is 12/12/02. |
Notes | 26 Nov
a const version of operator[] has been added to the specification. The non-const version has not been removed. The reasoning behind all this can be found on the discussion board, or ask a TA or instructor. List.H in F & R's public directory has been changed for this addition. 26 Nov Two clarifications regarding duplicate data items
|
You have been awarded a contract by the F & R software company to implement the List ADT as a class template based on the specification you and the head honchos at F & R have agreed upon.
Recall the List ADT presented in class:
You are responsible for complete documentation of the header file per
CMSC 202 coding standards.
You are at liberty to decide upon the private data members and
private methods. Only operator<< may be a friend
of the List class.
So where do you begin? How about the default constructor? You can't
do much until you create a list.
Then what? It's hard to do much of anything without being able
to insert data. How do you know if the data's really being inserted?
What about printing it out? After you have these three fundamental operations
working, you can choose which method to implement next.
There seems to be lots of code to write. In reality, almost all
the methods/functions are less than 15 lines of code and some are
as little as one line of code. You'll find some helpful code
in the text too.
One other thought.....think about how to use code you already wrote
(ie other List methods) to implement new List methods. If you choose
the order which methods are implemented wisely,
you can save yourself alot of coding.
You must submit a makefile for this project. The test file provided by
F & R will be named Proj5.C. Graders should be able to type
"make Proj5" and have the executable compile and link without error.
See the 202 Syllabus
for links to more information on make files.
The grade for this project will be broken down as follows:
Interface Description
This interface description uses T for the template parameter where needed.
See List.H for complete, syntactically correct prototypes.
Exceptions may only be thrown where indicated below.
All methods must handle empty lists properly.
For example if the host list = (2, 4, 8, 10) and
List1 = (1, 8, 12), then after merge()
the host list = (1, 2, 4, 8, 8, 10, 12).
If the host list is not sorted from smallest to largest, merge() sorts it.
If List1 is not sorted from smallest to largest, merge() throws the ListNotSorted exception.
Other functions
In addition to the List methods described above, the
following non-member function must also be supplied.
The prototype is completely specified in List.H
The LLNode class
Since the type of linked list is up to you, the linked list node class
definition is up to you, except that all data and member functions must be
private. The List class
should be made a friend of the linked list node class.
(Note - by making the List class a friend, all List methods are
made friends). The linked list node class must be defined in LLNode.H and
implemented in LLNode.C.
Exception classes
The agreed upon specification requires these exception classes.
These exception classes require no data and no methods.
These classes and their trivial implementation may be defined
in List.H.
Some Thoughts on Development
Implementing classes from a specification such as this is
a common programming task. The best strategy for developing
the code is "incremental development".
In the incremental development strategy, one small piece of code
(method) is written and tested. When the code passes all tests,
another small piece of code is written and tested. This incremental
process continues until the entire class is complete.
Project Make File
Grading