Problem: Concert Security Total Points: 50 Imagine you're a software developer for a stadium where your...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
To construct the SecurityCheck class for managing lines at a concert we need to implement the functionalities as per the requirements Heres an outline ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
BACKGROUND You are an information analyst working for NEE. The company president has asked you to prepare a Quantitative analysis of financial, sales, and operations data to help determine which...
-
In a plant producing multiple products, would absorption costing overcost or undercost the more complex products? Why?
-
Pope (2010) conducted a study to test if noise levels measured in decibels differed in medical/surgical nursing units compared to patient rooms. She found that noise levels were substantially higher...
-
Rebelcork Minerals is a publicly traded company listed on the Toronto Stock Exchange. On 1 January 20X4, the company granted 40,000 stock options to 50 of its employees. Relevant information about...
-
Explain how the control variate technique is implemented.
-
Emily Jackson (Social Security number 765-12-4326) and James Stewart (Social Security number 466-74-9932) are partners in a partnership that owns and operates a barber shop. The partnerships first...
-
A monopoly water slide has demand of p(Q) = a - bQ, where p is the price per slide ("ride"), Q is the quantity of slides demanded, and a, b > 0. Fixed costs are F = 0 and constant marginal costs are...
-
Provide or answer the following in relation to the Philippine Competition Act: 1. Provide the following: - the overview of the provision - the objective of the provision - when the act was enacted -...
-
What is the Residual income of new york? Keep-it-Going operates two profit centres, an amusement park based in Florida and a second amusement park based in New York. Consider the following data for...
-
give a one-page Communication Consultant Team Analysis based on one of the four workplace team scenarios provided in which you complete a Communication Audit: Assess Strengths Assess Weaknesses...
-
To start a restaurant in Itaewon, South Korea, Park Jihyun gets a loan plan from a private agency. The loan will pay him $40,000 at the beginning and a similar amount for the next five years in equal...
-
Randomly sampled math majors at a large university were asked to take part in a survey about the curriculum. The dean wanted to find out how challenging the math coursework was for students. The...
-
Please express in one paragraph why you feel there are benefits to Using an Outline for your Public Speaking?
-
A helical cast steel gear with 30 helix angle has to transmit 35 kW at 1500 r.p.m. n A helical cast steel with 30 helia angle has +o tanmiz 35 KW at 1500 Y An. Gear has 24 teeth , 20 full depth. The...
-
Simplify the expression. Assume that all variables are positive. 23VI1 2 V44 8
-
Deborah purchases a new $30,000 car in 2012 to use exclusively in her business. If Deborah does not elect to expense or take bonus depreciation in 2012 and holds the car until it is fully...
-
Diego, age 28, married Dolores, age 27, in 2012. Their salaries for the year amounted to $46,479 and they had interest income of $3,500. Diego and Dolores' deductions for adjusted gross income...
-
During the 2012 tax year, Irma incurred the following expenses: Union dues..............................................................$275 Tax return preparation...
-
Use the Internet to access Home Depot's most recent annual report. a. What evidence did you find that Home Depot continues to rely on present worth analysis in its corporate decision making? b. Does...
-
Use an Internet search engine to identify three companies or agencies that use present worth analysis to make business decisions as evidenced in their annual reports.
-
Use the Internet to access ConocoPhillips's most recent annual report. a. What evidence do you find that ConocoPhillips continues to rely on present worth analysis in its corporate decision making?...
Study smarter with the SolutionInn App