Question: This is in Java Code I don't need help with the exceptions. But if its necessary, these exception classes both have a no-parameter constructor, which

This is in Java Code

I don't need help with the exceptions. But if its necessary, these exception classes both have a no-parameter constructor, which just calls the corresponding superclass constructor.

This is in Java Code I don't need help with the exceptions.

TASK: Now that we have written some custom exceptions to handle some issues we might face when the user, we can build our actual Lab Queue. Write a LabQueue class with the following properties: It should have 4 private instance variables: LabQueueNode head to store the head (i.e., first) node, LabQueueNode tail to store the tail (i.e., last) node, int numTickets to store the current number of tickets in the Lab Queue, and boolean locked It must have a public no parameter constructor that initializes the instance variables to null, 0, and false accordingly It must have a no-parameter method called isLocked that returns the locked instance variable It must have a no-parameter method called size that returns numTickets It must have a no-parameter method called lock that changes locked from false to true. If locked was already true, the method must throw a DoubleLockException It must have a no-parameter method called unlock that changes locked from true to false. If locked was already false, the method must throw a DoubleUnlockException It must have a method called add that has one parameter of type HelpTicket called ticket. The method should create a new LabQueueNode containing ticket and make it the list's new tail (adjusting any nextNode references to keep the list functional). If the new LabQueueNode is the only node in the list, it should also become the list's head. The method should also increment numTickets. If locked was true before the method call, the method must throw an AddToLocked QueueException It must have a method called remove that has no parameters. The method should remove the list's head (adjusting any nextNode references to keep the list functional) and return the HelpTicket it contained. If no more LabQueueNode objects exist in the list, both head and tail should also be set to null. The method should also decrement numTickets. If the Lab Queue was empty before the method call, the method must throw a RemoveFromEmptyQueueException TASK: Now that we have written some custom exceptions to handle some issues we might face when the user, we can build our actual Lab Queue. Write a LabQueue class with the following properties: It should have 4 private instance variables: LabQueueNode head to store the head (i.e., first) node, LabQueueNode tail to store the tail (i.e., last) node, int numTickets to store the current number of tickets in the Lab Queue, and boolean locked It must have a public no parameter constructor that initializes the instance variables to null, 0, and false accordingly It must have a no-parameter method called isLocked that returns the locked instance variable It must have a no-parameter method called size that returns numTickets It must have a no-parameter method called lock that changes locked from false to true. If locked was already true, the method must throw a DoubleLockException It must have a no-parameter method called unlock that changes locked from true to false. If locked was already false, the method must throw a DoubleUnlockException It must have a method called add that has one parameter of type HelpTicket called ticket. The method should create a new LabQueueNode containing ticket and make it the list's new tail (adjusting any nextNode references to keep the list functional). If the new LabQueueNode is the only node in the list, it should also become the list's head. The method should also increment numTickets. If locked was true before the method call, the method must throw an AddToLocked QueueException It must have a method called remove that has no parameters. The method should remove the list's head (adjusting any nextNode references to keep the list functional) and return the HelpTicket it contained. If no more LabQueueNode objects exist in the list, both head and tail should also be set to null. The method should also decrement numTickets. If the Lab Queue was empty before the method call, the method must throw a RemoveFromEmptyQueueException

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!