Question: Java Plz complete the functions in Public interface Queue thank you! Tester codes at the bottom Size,isEmpty,enqueue,dequeue,peek,makeEmpty Tester Codes public static void main (String[] args)
Java Plz complete the functions in Public interface Queue thank you!
Tester codes at the bottom
Size,isEmpty,enqueue,dequeue,peek,makeEmpty

![codes at the bottom Size,isEmpty,enqueue,dequeue,peek,makeEmpty Tester Codes public static void main (String[]](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f50cb4225f0_60366f50cb3c7636.jpg)

Tester Codes
public static void main (String[] args) { try { testQueue(); } catch (Exception e) { System.out.println("Your code threw an Exception."); System.out.println("Perhaps a stack trace will help:"); e.printStackTrace(System.out); } System.out.println("Passed " + testPassCount + "/" + testCount + " tests"); } public static void testQueue() { System.out.println("testBasicQueue: start"); Queue q; int subtestSize; boolean subtestResult; q = new QueueRefBased(); displayResults(q.isEmpty(), "isEmpty on empty queue"); displayResults(q.size() == 0, "size on empty queue"); q = new QueueRefBased(); q.enqueue(10); displayResults(!q.isEmpty(), "isEmpty - queue with one element"); displayResults(q.size() == 1, "size - queue with one element"); q = new QueueRefBased(); subtestSize = 10; for (int i = 0; i charQ;
charQ = new QueueRefBased(); subtestSize = 10; for (int i = 0; i subtestResult = true; for (int i = 0; i
System.out.println("testing Queue: end"); System.out.println(); }
public interface Queue { * * Purpose: return the number of items currently pushed onto the queue. * Returns: the number of items in the queue * Examples: * If q is {x, y, z): q.size() returns 3. * If g is {} : q.size() returns 0. * int size(); * * * Purpose: returns the boolean state of the queue (empty or not empty) * Returns: true if queue is empty, false otherwise * Examples: * If g is {x, y, z): g.isEmpty() returns false. * If 4 is {}: q.isEmpty() returns true. */ boolean isEmpty(); /* * Purpose: places the values passed as a parameter onto the back of the queue. * Returns: nothing * Examples: * If qis {x, y, z: then after q-enqueue (a), qis {x, y, z, a} (i.e., front of the queue is the left-most value in the sequence, back of the queue is the right-most value in the sequence} - * If q is {} : then after enqueue (a), q is {a}. * * * * void enqueue (int element); * * Purpose: removes the value at the front of the queue (if it exists), and returns it to the caller. If the queue was empty before the call, then an exception is thrown by the method. * Returns: The value of type int at the front of the queue (if queue is non-empty) * Precondition: qis not empty * Examples: * If qis {x, yz): then after q.dequeue (), q is {y, z} and x is returned to the caller. * * int dequeue (); * * * Purpose: returns the value at the front of the queue (if it exists) but does not modify the contents of the queue. If the queue * was empty before the call, then an exception is throw by the method. * Returns: The value of type int at the front of the queue (if queue is non-empty * Precondition: qis not empty * Examples: * If g is {x, yz): then after q-peek), qis {x, y, z) and x is returned to the caller. */ int peek(); * * * Purpose: * clear the queue of all its content. * Returns: * nothing * Examples: * If g is {x, y, z) then after q.makeEmpty(), qis {} . * If g is {}: then after a makeEmpty(), qis {} . * void makeEmpty(); & * QueueNode.java * A node for a ref-based Queue, assuming that the queue * is meant to contains nodes storing values of type int. class QueueNode int data; QueueNode next; public QueueNode (int data) { this data = data; this.next = null; } public int getValue() { return this.data; } public QueueNode getNext() { return this.next; } public void setNext (QueueNode next) { this. next next; } public String toString() { return data + } }