Question
Please help with this Java Program. Thank you! we will be implementing an Ordered List ADT. Our goal is to implement the interface that is
Please help with this Java Program. Thank you!
we will be implementing an Ordered List ADT. Our goal is to implement the interface that is provided for this ADT. Notice that there are two interfaces: OrderedListADT builds on ListADT. In this homework, you'll only be responsible for the OrderedListADT.
Figure 1: UML Overview
1
Requirements
Create a doubly linked implementation of the OrderedListADT interface. Note that the book includes most of the source code for a singly linked implementation of OrderedListADT - plan to read over it, and reuse whatever is appropriate. In particular, notice which exceptions are used. You will need to create a total of four classes: DoubleOrderedList, DoubleNode, DoubleList, and Driver (for testing):
DoubleNode: A class that represents a doubly linked node. The source from LinearNode.java may be useful. [5 points]
DoubleList: A class that represents a doubly linked structure, with functionality to remove nodes. The source from LinkedList.java may be useful. Must implement ListADT
DoubleOrderedList: A class that extends the functionality from DoubleList by adding a method to add new elements. The source from LinkedOrderedList.java may be useful. Must extends DoubleList
Driver: This will be the class that contains the main, and testing code you write. [5 points]
Lastly, write appropriate testing documentation - Attached to this assignment are six files. The rst ve are from the textbook's source code but have been
slightly modifed - the package declaration was removed.
ListADT.java: This interface defines the list ADT.
OrderedListADT.java: This interface defines the ordered list ADT.
NonComparableElementException.java, EmptyCollectionException.java, ElementNotFoundException.java: These les implement the various exceptions your collection will need.
Driver.java: This le contains a very simple test case for DoubleOrderedList, and the output associated with it.
LIST.JAVA below
/** * ListADT defines the interface to a general list collection. Specific * types of lists will extend this interface to complete the * set of necessary operations. * * @author Lewis and Chase * @version 4.0 */ public interface ListADT{ /** * Removes and returns the first element from this list. * * @return the first element from this list */ public T removeFirst(); /** * Removes and returns the last element from this list. * * @return the last element from this list */ public T removeLast(); /** * Removes and returns the specified element from this list. * * @param element the element to be removed from the list */ public T remove(T element); /** * Returns a reference to the first element in this list. * * @return a reference to the first element in this list */ public T first(); /** * Returns a reference to the last element in this list. * * @return a reference to the last element in this list */ public T last(); /** * Returns true if this list contains the specified target element. * * @param target the target that is being sought in the list * @return true if the list contains this element */ public boolean contains(T target); /** * Returns true if this list contains no elements. * * @return true if this list contains no elements */ public boolean isEmpty(); /** * Returns the number of elements in this list. * * @return the integer representation of number of elements in this list */ public int size(); /** * Returns a string representation of this list. * * @return a string representation of this list */ public String toString(); }
Please find OrderedListADT.java below
/** * OrderedListADT defines the interface to an ordered list collection. Only * Comparable elements are stored, kept in the order determined by * the inherent relationship among the elements. * * @author Lewis and Chase * @version 4.0 */ public interface OrderedListADTextends ListADT { /** * Adds the specified element to this list at the proper location * * @param element the element to be added to this list */ public void add(T element); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started