Implement a doubly linked list and a test program according to the following specification.

The list contains objects of type class Element. Element contains the pointers prev and next for the list chain. Element also contains the end-user data. Use an int to represent the end-user data. Your constructor for Element takes the user data as parameter. The user data must be protected with the "private" modifier.

Class Element also has the following methods:

int getValue() // Returns the user data (an integer value)

void print() // Displays the user data on the screen.

The list is managed with an object of type class LinkedListBase.

Class LinkedListBase implements basic variables and operations for the linked list: pointers to first and last elements, maximum number of allowed elements in the list.

LinkedListBase(int maxlength) // Constructor with maximum number of elements allowed.

public void print() // Displays the text "LinkedListBase forward" and then displays the data of all elements in the list on the screen from first to last.

private void printBackward() // Displays the text "LinkedListBase backward" and then displays the data of all elements in the list on the screen from last to first.

private void append(Element elem) // Adds the given element to the list as the last element.

public void append(int a) // Appends a new element to the list containing the the given integer value a. The appended element is considered to be the last element.

private Element removeFirst() // Removes the first element and returns the int associated with it.

private Element removeLast() // Removes the last element and returns the int associated with it.

private Element getElement(int pos) // Returns the Element at position pos (1 <= pos <= count).

public int remove(int pos) // Removes the element at position pos (1 <= pos <= count) from the list.

public int remove(Element elem) // Removes the element elem from the list.

public boolean find(int val) // Returns true if val is in the list.

private int countElementsForward() // Returns the number of elements in the list by counting them explicitly from first to last.

private int countElementsBackward() // Returns the number of elements in the list by counting them explicitly from last to first.

public int count() // Returns the number of elements in the list.

public boolean isConsistent() // Consistency check - checks that the list pointers are correct.

You should handle any errors by displaying an appropriate message (use System.out.println).

Implement a program to test the class. Be sure to test at the limits, for example, lists with just one element or inserting the last element.

At the beginning of each method test for any invalid values of parameters. Check that the operation can be carried out.

Each method of LinkedListBase should be exhaustively tested with a dedicated test method.

Tip: The methods declared "private" may be convenient to use when implementing "public" methods. Try not to reinvent the wheel!

Tip: Test the private methods within the class LinkedListBase and the public methods in a separate test class.

You may NOT use Java List in your implementation!