[Solved]Need Change Code Class Driver Public Class Driver Public Static Void Main String Args Syst Q37153898

* You do not need to change any code in class Driver
*
*/
public class Driver
{
public static void main(String[] args)
{
System.out.println(“Create a deque:”);
DequeInterface<String>myDeque = new CircularDoublyLinkedDeque<>();
System.out.println(“nnisEmpty()returns ” + myDeque.isEmpty() + “n”);
System.out.println(“Add to frontand back of deque to getn” +
“Joe Jess Jim Jill Jane Jerryn”);
myDeque.addToFront(“Jim”);
myDeque.addToFront(“Jess”);
myDeque.addToBack(“Jill”);
myDeque.addToBack(“Jane”);
myDeque.addToFront(“Joe”);
myDeque.addToBack(“Jerry”);
System.out.println(“nisEmpty()returns ” + myDeque.isEmpty() + “n”);
System.out.println(“nnTestinggetFront, getBack, removeFront, removeBack:n”);
String front, back;
front = myDeque.getFront();
System.out.println(front + ” is atthe front of the deque.”);
back = myDeque.getBack();
System.out.println(back + ” is atthe back of the deque.”);
front =myDeque.removeFront();
System.out.println(front + ” isremoved from the front of the deque.”);
back =myDeque.removeBack();
System.out.println(back + ” isremoved from the back of the deque.”);
front =myDeque.getFront();
System.out.println(front + ” is atthe front of the deque.”);
back = myDeque.getBack();
System.out.println(back + ” is atthe back of the deque.”);
System.out.println(“nnTestingclear:n”);
myDeque.clear();
System.out.println(“nisEmpty()returns ” + myDeque.isEmpty() + “nn”);
try
{
front =myDeque.removeFront();
System.out.println(“removeFront incorrectly finds queue notempty”);
} // end try
catch (EmptyQueueException e)
{
System.out.println(“removeFront correctly finds dequeempty”);
} // end catch
try
{
front =myDeque.removeBack();
System.out.println(“removeBack incorrectly finds queue notempty”);
} // end try
catch (EmptyQueueException e)
{
System.out.println(“removeBack correctly finds deque empty”);
} // end catch
System.out.println(“nDone.”);
} // end main
} // end Driver
* You do not need to change any code in interfaceDequeInterface
*
*/
public interface DequeInterface<T>
{
/** Adds a new entry to the front/back of this dequeue.
@param newEntry An object to be added. */
public void addToFront(T newEntry);
public void addToBack(T newEntry);
/** Removes and returns the front/back entry of this dequeue.
@return The object at the front/back of the dequeue.
@throws EmptyQueueException if the dequeue is empty before theoperation. */
public T removeFront();
public T removeBack();
/** Retrieves the front/back entry of this dequeue.
@return The object at the front/back of the dequeue.
@throws EmptyQueueException if the dequeue is empty before theoperation. */
public T getFront();
public T getBack();
/** Detects whether this dequeue is empty.
@return True if the queue is empty, or false otherwise. */
public boolean isEmpty();
/** Removes all entries from this dequeue. */
public void clear();
} // end DequeInterface
/**
*
* 2 D ADD THE CODE HERE IN THIS CLASS
*
*/
public class CircularDoublyLinkedDeque<T> implementsDequeInterface<T>
{
private DLNode firstNode;
public CircularDoublyLinkedDeque()
{
}
public void addToBack(T newEntry)
{
}
public void addToFront(T newEntry)
{
}
public T getFront()
{
}
public T getBack()
{
}
public T removeFront()
{
}
public T removeBack()
{
}
public void clear()
{
}
public boolean isEmpty()
{
}
/**
* class DLNode
* You do not need to change any code in class DLNode
*
*/
private class DLNode
{
private T data; // Deque entry
private DLNode next; // Link to next node
private DLNode previous; // Link to previous node
private DLNode()
{
this(null, null, null);
} // end default constructor
private DLNode(T dataPortion)
{
this(null, dataPortion, null);
} // end constructor
private DLNode(DLNode previousNode, T dataPortion, DLNodenextNode)
{
data = dataPortion;
next = nextNode;
previous = previousNode;
} // end constructor
private T getData()
{
return data;
} // end getData
private void setData(T newData)
{
data = newData;
} // end setData
private DLNode getNextNode()
{
return next;
} // end getNextNode
private void setNextNode(DLNode nextNode)
{
next = nextNode;
} // end setNextNode
private DLNode getPreviousNode()
{
return previous;
} // end getPreviousNode
private void setPreviousNode(DLNode previousNode)
{
previous = previousNode;
} // end setPreviousNode
} // end DLNode
} // end CircularDoublyLinkedDeque
D. 10 pointsUse a circular doubly linked chain to implement the ADT deque. In a doubly linked chain, the first and last nodes each Create a deque: contain one null reference, since the first node has no previous node and the last node has no node after it. In a circular doubly linked chain, the first node references1smpty) returns true the last node, and the last node references the first. Only one external reference is necessary-a reference to theAdd to front and back of deque to get first node-since you can quickly get to the last nodeJoe Jess Jim 3111 Jane Jerry from the first node. The code for this problem is provided in the 1sEmpty) returns false Assignment-03-Code.zip archive. Your output must be identical to the output to the right. Testing getFront, getBack, removeFront, removeBack: Joe is at the front of the deque erry is at the back of the deque Joe is removed from the front of the deque Jerry is removed from the back of the deque Jess is at the front of the deque Jane is at the back of the deque. Testing clear: 1sEmpty) returns true removeFront correctly finds deque empty removeBack correctly finds deque empty Show transcribed image text D. 10 pointsUse a circular doubly linked chain to implement the ADT deque. In a doubly linked chain, the first and last nodes each Create a deque: contain one null reference, since the first node has no previous node and the last node has no node after it. In a circular doubly linked chain, the first node references1smpty) returns true the last node, and the last node references the first. Only one external reference is necessary-a reference to theAdd to front and back of deque to get first node-since you can quickly get to the last nodeJoe Jess Jim 3111 Jane Jerry from the first node. The code for this problem is provided in the 1sEmpty) returns false Assignment-03-Code.zip archive. Your output must be identical to the output to the right. Testing getFront, getBack, removeFront, removeBack: Joe is at the front of the deque erry is at the back of the deque Joe is removed from the front of the deque Jerry is removed from the back of the deque Jess is at the front of the deque Jane is at the back of the deque. Testing clear: 1sEmpty) returns true removeFront correctly finds deque empty removeBack correctly finds deque empty
Expert Answer
Answer to * You do not need to change any code in class Driver * */ public class Driver { public static void main(String[] args) {… . . .
OR

