Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
- dequeue method
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started