Dynamic List Class

Short Description:

Create a dynamic list class.

This assignment is worth 60 points.

Goals

When you finish this homework, you should:

Formal Description

You should implement a dynamic list class. Your list class should contain elements of type ItemT, where each item has a key field. In this case, key will be a string. Your class should contain an index, which allows the user to step through the list. This class should contain the following member functions: ItemT has a member function key() which returns the value of key associated with the instance.

Your list should be dynamic, and be ordered from the lowest key value to the highest.

You should further implement any additional member functions required for dynamic memory.

The internal index is invalid, and should be set to the first item, whenever items are inserted or deleted from the list. You should be able to use the index to iterate through the list.

ListT l;
...
for(l.Reset();!l.IsLast();l.NextItem()) {
    cout <<  l.GetItem();
}

if (l.ValidIndex()) {
    cout <<  l.GetItem();
}

To demonstrate your list, you should write two programs. The first should test all member functions.

The second program should maintain three lists of students. These students are classified as "good" if their grade average is 3.0 or higher, "average", if their grade average is 2.0 to 2.99, and "poor" if their grade average is below 2.0. Your program should read from the input file grades.dat, processing the following commands:

An example data file:

grade 2.98 Merlin
grade 3.01 Sir Kay
grade 1.0 Sir Robin
grade 4.00 Arthur King of the Britons
add   .03 Sir Kay
add   -.99 Sir Robin
query Arthur King of the Britons
query Lancelot
print good
printall

Discussion

Required Files

You should submit the following in a tar file: You should not submit

Submission

Please create a tar file containing the files described above. Email this file to danbennett360@gmail.com by class time of the due date.