Starting from:

$30

CS1331-Homework 7 Office Hours Queue Solved

You’re an innovative TA for CS 1321. You’ve noticed your whiteboard queue system often gets crowded and complicated on busy days. You decide that, since you learned JavaFX when you took the course, you will implement an office hours queue in JavaFX.

 

One possible design of the application

Solution Description
For this homework, your main task is to build a JavaFX application, called OfficeHourQueue (this is the name of the class), which meets the following functional requirements:

Allows students to type their names into a text box and add themselves to the queue by clicking a button
Allow TAs to press a “dequeue” button to remove the student at the head of the queue. This is a privileged action (see below for more details).
Display the queue, with the most recently added students at the bottom of the queue (lower on the screen).
Display the current size of the queue, along with the maximum size the queue has ever reached.
For privileged actions, the program should display a pop-up asking the user for a password. The correct password is “CS1321R0X”. If the user enters an invalid password, the action should have no effect. Otherwise the action should proceed.
It is entirely possible to complete this assignment using a simple LinkedList and updating a series of basic nodes within a VBox, however you may want to consider using the javafx ListView class and some of the methods within FXCollections. We will be grading based on the functionality of your GUI, so how you decide to implement it is up to you.

Note: For OfficeHourQueue, you are allowed to import anything that doesn’t trivialize the assignment. For example, you may use java.util.LinkedList or javafx.collections.FXCollections.observableArrayList() as a collection for storing students currently in the queue, or any any JavaFX classes you need. You shouldn’t import some GUIQueueWithPasswordSupport class that does the entire assignment for you. If you aren’t sure about a specific import, ask on Piazza.

Extra Credit
For extra credit, you have the option to implement your own queue instead of using LinkedList or the FXCollections ObservableArrayList for keeping track of the students in office hours. Your queue should be a linked list contained in a generic class called LinkedQueue<E, which must extend ModifiableObservableListBase and implement the following two interfaces: Iterable and SimpleQueue.java. The LinkedQueueNode.java class has been provided to help with your implementation.

You must use an instance of LinkedQueue for keeping track of students within OfficeHoursQueue to receive extra credit. Thoroughly test your GUI to ensure everything functions appropriately.

Note: For LinkedQueue, you are allowed to import java.util.Iterator, java.util.NoSuchElementException, and javafx.collections.ModifiableObservableListBase. Do not import any lists, sets, or collections from java.util. If you want to use any other imports, ask on Piazza.

More products