Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem: Concert Security Total Points: 50 Imagine you're a software developer for a stadium where your favorite K-pop group, TWICE, is having a concert.

imageimageimageimageimage

Problem: Concert Security Total Points: 50 Imagine you're a software developer for a stadium where your favorite K-pop group, TWICE, is having a concert. Before a person gets into the concert, there is a security check with n lines where n decreases or increases depending on the available staff. The stadium needs to manage all lines and needs your help. Construct a program which manages all lines while maintaining the following conditions: 1. A person stands in line in ascending order corresponding to their seat number 2. All lines must be balanced, with each line having a difference in length of at most 1 person AT ALL TIMES Because n is flexible, both lines and concert attendees must be managed using singly linked lists you've designed yourself (DO NOT use an ArrayList). So, just as you might add a person to a line represented through a linked list, you might need to add a line to a set of lines also represented through a linked list. At the start of the concert (and your program), n = 1. Your program must run on its own and should not crash. Use exception handling as required. If your program does not compile, you will receive a 0 for it. You have to write all the CODE BY YOURSELF. Any form of plagiarism will result in 0 in the homework and possibly even a Q for the course. Required Classes and More: The following classes are required for this problem. Each class provides a description and the specifications necessary to complete its implementation. If you feel that additional methods or variables would be useful, feel free to add them during your implementation as you see fit. However, all the variables and methods in the following specifications must be included in your homework. You should declare the data fields of the classes as private and should provide the public getter and setter methods if required. Additionally, "fully documented classes" are classes which have enough reasonable comments and documentation for TAs and the professor to understand your implementation of this assignment. There is no strict criteria, but at the minimum you must include comments that describe crucial steps of computation within your implementation. 1. Person (Linked List Node) Points: 10 Write a fully documented class named Person that contains ticket information of each person and references the next person in line. The Person class should contain variables for the person's name, seat number, and next person in line. public Person() constructor and also public Person(...parameters as needed...) One String variable: name One int variable: seatNumber One Person variable nextPerson Getters and setters for all members. 2. Line (Linked List and Linked List Node) Points: 15 Write a fully documented class named Line that contains people waiting in line in ascending seat order. The Line class should contain a Person reference to the start of your line and its length. Additionally, each line should reference the next available line in your set of n lines. public Line() constructor Two Person variables . headPerson tailPerson One int variable: length One Line variable o lineLink public void addPerson(Person attendee) Brief: Adds a person to a line while maintaining condition 1. Parameters: attendee - person to be added. Preconditions None. Postconditions Returns Throws The person is added to the list in ascending order. None. None. public Person removeFrontPerson() Brief: Removes the person at the front of the line. Parameters: None. Preconditions Line is not empty. Postconditions Returns Throws The next person from list is removed from the list. Person removed from the list. None. 3. SecurityCheck (Linked List) Points:15 Write a fully documented class named SecurityCheck that contains all lines and is able to increase/decrease the number of lines available. The SecurityCheck class should contain a reference to your first line and your number of available lines. Public SecurityCheck() constructor Three Line variables o headLine o tailLine o cursorLine One int variable: lineCount public void addPerson(String Name, int seatNumber) Brief: Adds a person to a line while maintaining condition 2. Parameters: name - Name of the person to be added. seat Number - The number of this attendee's seat Preconditions The person's seat number is found in any line. Postconditions Returns Throws The person is added to the list that maintains condition 2. None. TakenSeatException: Thrown if a person's seat number is found in any line. public Person removeNextAttendee() Brief: Removes the person from the list with the lowest seat number that allows you to maintain condition 2 (may not have the absolute lowest seat number). Parameters: None. Preconditions All Lines are not empty. Postconditions Returns The person from the list with the lowest seat number that maintains condition 2 is removed. Person removed from security check lines. Throws AllLinesEmptyException: Thrown if all lines are empty but a next person is requested. public void addNewLines(int newLines) Brief: Adds new lines while maintaining conditions 1 and 2. Parameters: newLines - The number of lines to add Preconditions None. Postconditions The number of available lines is adjusted while maintaining conditions 1 and 2. Returns Throws None. InvalidLineCountException: Thrown if newLines is negative. public void removeLines(int[] removed Lines) Brief: Removes lines while maintaining conditions 1 and 2. Parameters: removed Lines - An array containing the indices of lines removed (indices start at 1) Preconditions Lines must exist or not remove a single available line. Postconditions The number of available lines is adjusted while maintaining conditions 1 and 2. Returns Throws None. LineDoesNotExistException: Thrown if a line does not exist SingleLineRemoval Exception: Thrown if one attempts to remove the only line available. 3. Security Manager Points: 10 Write a fully documented class named SecurityManager. This class will allow the stadium staff to queue new attendees and adjust the number of lines available. Must contain your main method public static void main (String [] args) One SecurityCheck variable securityCheck This method should implement the following menu options: o (A) Add Person (N) Next Person (R)- Remove Lines (L) - Add New Lines (P) Print All Lines (Q)-Quit Sample Input/Output // Comment in green, input in red, output in black Example: Adding a Person Starting... Line 1:0 People Waiting Menu: (A) Add Person (N) - Next Person (R) Remove Lines (L) - Add Lines (P) - Print All Lines (Q) - Quit Please select an option: A

Step by Step Solution

3.38 Rating (151 Votes )

There are 3 Steps involved in it

Step: 1

To construct the SecurityCheck class for managing lines at a concert we need to implement the functionalities as per the requirements Heres an outline ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions