Consider a new kind of queue that allows only a single copy of an object in the
ID: 3545698 • Letter: C
Question
Consider a new kind of queue that allows only a single copy of an object in the queue. If an object is added to the queue, but it is already there, leave the queue unchanged. This queue has another operation moveToBack that takes an object in the queue and moves it to the back. If an object is not in the queue, the operation adds it at the back of the queue. Create an interface NoDuplicatesQueueInterface that extends QueueInterface and save as NoDuplicatesQueueInterface.java. Then write an array-based implementation of NoDuplicatesQueue and save as NoDuplicatesQueue.java. Finally, write a program that adequately demonstrates your new class and save as Driver.java. Here is QueueInterface: /** An interface for the ADT queue. @author Frank M. Carrano @version 3.0 */ public interface QueueInterface { /* Adds a new entry to the back of this queue. @param newEntry an object to be added */ public void enqueue(T newEntry); /* Removes and returns the entry at the front of this queue. @return either the object at the front of the queue or, if the queue is empty before the operation, null */ public T dequeue(); /* Retrieves the entry at the front of this queue. @return either the object at the front of the queue or, if the queue is empty, null */ public T getFront(); /* Detects whether this queue is empty. @return true if the queue is empty, or false otherwise */ public boolean isEmpty(); /* Removes all entries from this queue. */ public void clear(); } // end QueueInterfaceExplanation / Answer
Deadline for this ?
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.