Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In this project, you will implement the Queue data structure and use it to creat

ID: 644040 • Letter: I

Question

In this project, you will implement the Queue data structure and use it to create a player for Rotisserie Nim. Since we are only going to implement very basic Queue operations, we'll name the class PureQueue.

Part 0: Create a new folder for this project. Create a new file, PureQueue.java, where you will implement your version of a Queue. (Here again is EmptyClass.java if you'd like it.) First, write or update the Javadoc file header to include your own description of the class and an @author tag with your names.

Part 1: Consider a no-parameter constructor. Write it (Javadoc). While doing this (if you haven't already) you'll probably decide that it's time to add a field; a different data structure to use as your underlying data. You can't use one of Java's premade Queues, but you could try using something you've already seen... If you do use an ArrayList, which ends will represent the front and back?

Part 2: Write a toString method. Afterwards, write a main method to be a unit test for your class. Test your constructor andtoString.

Part 3: Implement add. Some types of Queues have restricted size, so there's a chance that the element won't be added. This is why the return type is listed as boolean. Yours won't have this restriction, so you don't need to throw any exception(s) here. Once you get it working, add tests to your unit test!

Part 4: Implement remove, which removes and returns the next element. There are times when this should throw a NoSuchElementException. When should it throw this exception? There are two ways to test for throwing: either use a conditional or catch another possible exception!

Part 5: Implement element, which returns the next element, but doesn't remove it. When should this throw an exception?

Part 6: Implement isEmpty, which returns whether the queue is empty.

Part 7, 10 points: Implement equals. Just like last time, the signature of this method should look like:

Implement this method.

Explanation / Answer

PureQueue.java

ArrayQueue.java

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote