Lab Demonstration: The Queue Operations. Think about what we're doing, and how to put it into code. Coding - Submit all .java files to the LMS. The Queue. Create a class called Queue with the following methods: public Boolean is Empty (); public void enqueuer (String item); public String dequeuer (); public void dequeuer All ( ); public String peek (); public in size (); the class should have only one variable of type Single Linked List to hold the queue. You are not allowed to use a Java library linked list: You must create it. Do not simply create a linked list that acts as a queue: the objective of this lab is to use code you already have and abstract it into something else. You must fully encapsulate your linked list in your queue, meaning wherever there can be an error, throw a custom unchecked exception called Queue Exception with a message that shows what the error is. Do not display Linked List Exceptions: you must handle them and throw a new exception with a different message. Also add a to String method to display the queue, in proper order, with commas between the elements, but not after the last one. Do not show the value at the end of the queue. You cannot use your linked lists to string method for this: remember, we're fully encapsulating the list into a queue, and we don't want the user to know it's a linked list, so you must re-create the two String method. Do NOT use a Queue or any other Java-provided data structure. Doing so will result in a mark of zero for this lab. Testing the Queue. Create a test class to test your queue. In your test class: (a) Add ten names (One must be yours, the rest can be random) to the queue. Print the queue after every addition. (b) Remove some names from the queue, printing the queue after each. (c) Catches any exceptions thrown as we did in the last lab. Do not catch any exceptions in your object: only in the test class main method.

Q&A Education