Lab 6

February 26, 2004

Partners

You may work with at most one other person on this assignment. If you do, you will both receive the same grade.

Alex's Sample Solution

Linked List Implementation of List ADT

The purpose of this in-lab is to give you some experience with a linked list implementation of the list ADT. To this end, please copy the code that we talked about on Monday, February 23rd into a BlueJ project named Lab6.

Part I (50%)

Change the Data class so that it consists of a first name and a last name (both Strings). Modify the Driver class so that 10 is replaced by Bobby Brady, 20 is replaced by Marsha Brady, 30 is replaced by Cindy Brady, 5 is replaced by Peter Brady, 15 is replaced by John Adams, 25 is replaced by George Washington, and 35 is replaced by George Bush.

Once your program is running properly, call over the lab TA. He will make sure that you have organized the Driver.java file properly and will then run the program to see whether you are obtaining the correct results.

Part II (50%)

Modify the List class so that there is a dummy node placed at the start of the list with the name AAA AAA and there is a second dummy node placed at the end of the list with the name ZZZ ZZZ. (Note: Dummy nodes should never be printed!) Simplify the code in the List class as much as possible. The presence of the dummy nodes should enable quite a bit of simplification to take place.

When you are finished, print out your List.java file and then call over the lab TA. He will run your program to make sure that it is still working properly. Your List.java code will be graded on how well you have simplified it and the quality of the changes. Comments are not necessary.

Before You Leave

Please delete any BlueJ projects that you created and empty the recycle bin. Thank you.

Valid XHTML 1.0!