In this lab you will again finish a partially written Java GUI application that demonstrates the basic functions of a queue. This project is similar to Lab04 but it implements a Queue class as a linked list rather than a circular array. Many features of the linked list itself are identical to those you encountered in Lab07, where you performed a similar revision of the Stack class.
Now just in case you have forgotten what a queue does, recall that its rules for insertion and removal of items are as follows:
Again, these rules are sometimes summarized by saying that a queue is a FIFO ("First In, First Out") list. In contrast, a stack is called a LIFO ("Last In, First Out") list.
As usual, the GUI test framework has already been created and tested, and source files for the relevant application classes are provided to you. Your main task is to complete a partially written source file Queue.java, which defines the instance variables and methods for a Queue class that stores its data values in a singly linked list.
For this lab you will again be given a complete source file Node.java that represents the individual nodes in the linked list. The Node class definition includes a fully working paint() method, which allows applications to render nodes graphically.
After you have completed the Queue class implementation as described below, you will be able to compile all the files and run the project. As in Lab07, the GUI framework will explicitly display the Queue class as a linked list. For an empty Queue, with no nodes present, you will see only two null links labeled Front and Rear respectively:

If you now inserted the names "Patricia", "Howard", "Martin", and "Jennifer" in that order, the queue would appear as shown below:

If you now clicked the Remove button to remove the front node ("Patricia"), you should see

The Queue will also be provided with a peek() method that allows an application to determine the frontmost data value without removing it. You should recall that a similar method was introduced for a Stack in Lab07. If you now clicked the Peek button, you should see the following:

Finally, clicking the Print All button raises a dialog box that lists the complete queue contents, from front to rear, as shown below:

To enable this last feature, the Queue class will be provided with a printAll() method similar to the one you implemented for the Stack in Lab07.
When you have built this project, you should test it using similar examples to make sure that all your Queue methods are working correctly.
To complete this project, follow the steps listed below:
| DisplayFrame.java | DisplayPanel.java | InfoDialog.java | ErrorDialog.java | Queue.java | Node.java | Paintable.java |
DisplayFrame frame = new DisplayFrame(); frame.setVisible(true); frame.setInitialFocus();
You should now proceed to implement these methods, so that they perform the following tasks:
Note: The special case of adding to an empty queue requires care, since in that case both the rear and front pointers must be updated.
Note: Again, removing the last value from the Queue requires special care, since in this case both the rear and front pointers must be updated.
When your project is complete and working correctly, demonstrate it to your lab instructor. Then, before you exit NetBeans, clean your Lab08 project. Finally, before you logout, open a terminal window and use the cd command to enter your csci/202/labs directory. Then create a JAR file of your Lab08 project folder, using the command
jar cf Lab08.jar Lab08Please leave Lab08.jar in your csci/202/labs directory for the remainder of the semester.