Lab #8
Fall, 2000
You must submit this lab by 11:59 pm on Friday, November 17
1. Objective
In this lab, you are required to construct and manipulate a list ADT, which uses a linked list to hold integer numbers.
2. Creating a List ADT
In a file called List.java, write the description
for two classes: an Node class and a List class.
The Node class will contain an integer number and the
next Node in a list.
Neither of these classes should use Stdin or
print anything.
The List class contains the list ADT operations. You must use use linked lists to implement the list ADT. Lists should be maintained so that the integers are placed in non-decreasing order (note: duplicate values are permitted). The List must contain (at least) the following methods:
public List ()
public String toString ()
public void insert (int item)
item into a list.
The item should be inserted so that the list is maintained
in non-decreasing order.
public void deleteAll (int item)
item from a list.
public List copy ()
public void mergeFrom (List other)
public void reverse ()
List object. This will cause the list to
be in non-increasing order. You can assume that reversing
will be the last possible operation on a list, so you
do not have to complicate your other methods (insert,
delete, and mergeFrom).
In addition to these methods, the class may also contain any fields, methods, or inner classes that you feel are appropriate.
3. Using the List ADT
Write a main method (in a class called Lab8) that uses the List
class to perform the following operations.
You may write any additional methods you need to help you.
4. FAQ
5. What to Submit
Submit your Lab8.java and List.java files along with Stdin.java.
Use the command: submitaps105f 8 List.java Lab8.java Stdin.java