Question: Finish the following methods Queue.java dequeue method This method should remove the item at the front of the queue If there isn't anything in the

Finish the following methods

  • Queue.java
    • dequeue method
      • This method should remove the item at the front of the queue
      • If there isn't anything in the queue, it shouldn't crash
    • getFront method
      • This method should return a pointer to the item at the front of the queue
      • Note, this item is NOT removed from the queue
    • getFrontAndDequeue method
      • This method should return a pointer to the item at the front of the queue
      • Note, this item IS removed from the queue
    • enqueue method
      • This method should add an item to the back of the queue
    • isEmpty method
      • This method should return true if the queue contains no items, false otherwise
    • makeEmpty method
      • This method should remove everything from the queue

public class Queue {

public void dequeue() { } public AnyType getFront() { return null; } public AnyType getFrontAndDequeue() { return null; } public void enqueue(AnyType t) { } public boolean isEmpty() { return Math.random() < 0.5; } public void makeEmpty() { }

}

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 Programming Questions!