Question: I keep getting this error. Could you help me with it? Thanks! For the question below, assume the following implementation of LinkedQueue: public static final

I keep getting this error. Could you help me with it? Thanks!I keep getting this error. Could you help me with it? Thanks!

For the question below, assume the following implementation of LinkedQueue: public static final class LinkedQueue implements QueueInterface { private Node firstNode; private Node lastNode;

public LinkedQueue() { firstNode = null; lastNode = null; }

@Override public T getFront() { if (isEmpty()) { return null; } return firstNode.getData(); }

@Override public boolean isEmpty() { return firstNode == null; }

@Override public void clear() { firstNode = null; lastNode = null;

}

public class Node { private E data; // Entry in bag private Node next; // Link to next node

public Node(E dataPortion) { this(dataPortion, null); } // end constructor

public Node(E dataPortion, Node nextNode) { data = dataPortion; next = nextNode; } // end constructor

public E getData() { if (data != null) { return data; } return null; }

public Node getNext() { return next; }

public void setNext(Node newNext) { next = newNext; }

} // end LinkedQueue

2.0 / 3.0 Result Behavior 1/** 2 @precondition: queue is not empty 3 @return value from removed node that was at the front of the queue 4 5@Override 6 public T dequeue() { 7 if (isEmpty()) return null; 9 I frontValue = getFront(); 10 firstNode.setData(null); 11 firstNode = firstNode.getNext(); 12 Dequeue updates first node Dequeue updates properly when empty Expected: but was: Dequeue updates properly when not empty 13 14 return frontValue; 15 16]} 17 2.0 / 3.0 Result Behavior 1/** 2 @precondition: queue is not empty 3 @return value from removed node that was at the front of the queue 4 5@Override 6 public T dequeue() { 7 if (isEmpty()) return null; 9 I frontValue = getFront(); 10 firstNode.setData(null); 11 firstNode = firstNode.getNext(); 12 Dequeue updates first node Dequeue updates properly when empty Expected: but was: Dequeue updates properly when not empty 13 14 return frontValue; 15 16]} 17

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!