[SOLVED] CS1331 Homework 7

24.99 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (4 votes)

Office Hours Queue

Problem Description

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.

Rubric

This homework has 90 points of extra credit for a total of 190 points.

[100] OfficeHourQueue

  • [10] Student name text box and buttons exist.
  • [20] Dequeue button exists and removes students.
    • If you do not implement the privileged action pop-up, remove them anyways for credit.
  • [30] Queue properly displays students, with the most recently added students at the bottom.
  • [20] Current queue size and historical maximum queue size displays.
  • [10] Pop-up displays for privileged actions.
  • [10] Actions do not take effect if invalid password is entered.

[90] LinkedQueue

  • [10] enqueue adds an element to the queue
  • [12] doAdd
    • [10] Adds an element to the queue at a specific index
    • [2] Throws an IndexOutOfBoundsException if the index is invalid
  • [12] dequeue
    • [10] Removes the least recently added element when queue is non-empty
    • [2] Returns null when queue is empty
  • [12] doRemove
    • [10] Removes an element from the queue at a specific index
    • [2] Throws an IndexOutOfBoundsException if the index is invalid
  • [12] get
    • [10] Returns an element from the queue at a specific index
    • [2] Throws an IndexOutOfBoundsException if the index is invalid
  • [2] doSet throws an UnsupportedOperationException
  • [15] LinkedQueue is Iterable<E>
    • [5] Implements Iterable<E> and has compiling iterator() method
    • [5] hasNext() method properly implemented in Iterator
    • [5] next() method properly implemented in Iterator
  • [5] size() method returns size of queue
  • [5] clear() method empties queue and sets size to 0
  • [5] isEmpty() method returns true when queue is empty, false otherwise

 

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.