COSC 072: Computer Science II

Project 3
Spring 2005

Due: Apr 8 @ 5 PM
8 points

This project involves implementing a List ADT using a doubly-linked list and a Vector ADT using a dynamically allocated C-style array. Senior software engineers often design classes and give them to junior programmers to implement and test. For this assignment, you will not only learn how to code List and Vector ADTs, but also you will get some experience coding someone else's specification.

  1. Retrieve the zip file I've prepared for p3 with three easy commands:
    gusun% cp ~maloofm/p3.tar.gz ./
    gusun% gunzip p3.tar.gz
    gusun% tar -xf p3.tar
    
    In this archive, there should Makefile, Makefile.dep, main.cc, main.h, list.h, and vector.h.

  2. Implement the Node<T> class for doubly-linked nodes. You can just modify the Node<T> class from P2, but if you really want to be on the edge, you can derive the DLNode<T> class from the Node<T> class. (Sorry, no extra credit.)

  3. Use the doubly-linked Node<T> class to implement the List<T> class. Many methods from P2 are similar to those in List<T>. You could do some fancy stuff, but it is fine to move relevant code from P2 and modify it for List<T>.

  4. Use a dynamically allocated C-style array to implement the Vector<T> class. We will discuss the design and function of this class in lecture. Since you have some experience with linked lists, implement List<T> before implementing Vector<T>.

  5. I've generated DOC comments for the methods of both classes, and the method stubs for the class are in the files list.h and vector.h. Documentation: [HTML | PDF].

  6. Test your implementation of the List<T> class and Vector<T> class. However, we will use our own main function to evaluate your classes. As a result, you must not modify the class names or the public interfaces. This would also be an important consideration for any large-scale software project. Our main.cc will include only main.h, so put any necessary includes there. But, in general, you should not need to declare any additional methods or data members.

Use stepwise refinement and incremental development. For example, implement and test the Node<T> class before implementing the List<T> class. Try to determine a dependency among the methods of, say, the List<T> class, and code the methods in the order of their dependence. Implement and test one method---even short ones---before attempting to implement the next. This should help you manage and reduce the number of compiler errors.

Instructions for Electronic Submission:

If you need to include a message to your TA about your submission, then place the message in a file named README. Place the README file in the p3 directory.

At the top of the file main.cc (or the file containing the main function), place the following header comment, with the appropriate modifications:

//
// COSC 072 Project 3
// Name: <your name>
// ID: <GoCard ID>
// E-mail: <e-mail address>
// Instructor: Maloof
// TA: <TA's name>
//
// In accordance with the class policies and Georgetown's Honor Code,
// I certify that, with the exceptions of the class resources and those
// items noted below, I have neither given nor received any assistance
// on this project.
//

Although you may use any C++ compiler to develop your program, it must run under UNIX and must compile using GNU g++. You must also provide a working UNIX Makefile for your project.

Before submitting, to reduce the size of the tar file, type 'make clean'.

To move up from the p3 directory, type

% cd ..
(Additional UNIX commands at the bottom of this page: HOWTO Compile under UNIX)

When you're ready to submit, change the name of the directory to your netid. For example, if your netid is maloofm, then rename the directory p3 by typing

% mv p3 maloofm
Create a tar (tape archive) file of the directory and its contents by typing
% tar -cf p3.tar maloofm
This command creates a tar file named p3.tar containing the directory maloofm/ and the files therein.

Compress the tar file by typing:

% gzip p3.tar
This command will produce a file named p3.tar.gz, which is the gzipped tar file of the directory containing your project. Whew!

To submit the file, type

% submit -a p3 -f p3.tar.gz
p3 is the name of the assignment (-a) and p3.tar.gz is the file (-f) to be submitted for that assignment.

If the program submits the file successfully, you will receive a receipt by e-mail at the address <netid>@georgetown.edu.

Submit your project only once.

Once you've submitted your project, it is important to keep an electronic copy on a university machine (e.g., gusun or cssun). System administrators routinely back up these machines.

You can also change the directory's name back to the original name. For example,

% mv maloofm p3
You can also remove the tar file from your directory:
% rm p3.tar.gz

The TAs who will be grading your projects this semester are listed on the main page. You must submit your project before 5 PM on the due date.

If you're running submit correctly and you see an error message labeled as SEVERE, then execute Plan B by using pine to submit your project as an attachment to an e-mail.

To accomplish this, at the gusun prompt, type 'pine'. When the menu appears, select the menu item for composing messages (C). In the To field, type the e-mail address cosc072maloof@cs. Attach your zip file. Control-T (symbolized ^T) will give you a list of files. Select the file to attach. The subject should be your netid followed by the extension .zip. For example, if your netid is maloofm, then the subject of the e-mail should be maloofm.zip. There's no need to include anything in the MESSAGE TEXT screen.

Once you've entered this information, the screen should look something like the following:

Finally, type ^X (Ctrl-X) to send the e-mail to the course account.