Question: In Java--- PLEASE ENSURE ALL REQUIREMENTS ARE MET BEFORE SUBMITTING All methods work correctly per instructions array (add, remove, peek, print, ifFull, isEmpty) More added

In Java---

PLEASE ENSURE ALL REQUIREMENTS ARE MET BEFORE SUBMITTING

All methods work correctly per instructions array (add, remove, peek, print, ifFull, isEmpty) More added to the driver all necessary attributes included with private access modifier header comments and javadoc included

Rewrite the following assignment using a linked list instead of an array.

Implement a linked list in java. Identify the necessary methods in a List Linked implementation (do not forget a display method) Write a linkedList class (you will need a link class as well) Write a driver (tester) to show you have implemented all the necessary methods and appropriately defined your linkedList class

Implement a queue using an linked list in class. Make your queue size 5.

An linked list will need to handle wrap around.

Think about removing from the front of a full queue.

The queue will not be empty, but the items will be in indices 1, 2, 3 and 4 and index 0 will be free and the queue is not longer full.

It would be inefficient to move all elements up in the linked list. However, the head is now at 1 and the tail is at 4, so you would add the 5th item in index 0.

Queue() creates an empty queue, queue is new and empty. enqueue(item) adds a new item to the queue, queue is modified. dequeue() removes and returns an item, queue is modified. isEmpty() returns a boolean and tests for an empty queue, queue is not modified. size() returns the int size of the queue, queue is not modified print() prints the queue from front to rear, queue is not modified. peek() prints the front element, queue is not modified. Driver should print the results of the following enqueue("dog") enqueue("cat") enqueue("mouse") enqueue("pig") enqueue("bird") size() enqueue("puppy") size() dequeue() dequeue() size() dequeue() peek() dequeue() dequeue() size() isEmpty()

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