” CSCI 1110作业 写作、data留学生编程 辅导CSCI 1110: Assignment 4Due: 8:00 am, Tuesday, November 24, 2020The purpose of this assignment is to reinforce your understanding of linear datastructures such as lists and queues. For this problem you will be provided with sampletests in Mimir. All input is done via the console and all output is to be done tothe console as well. You must submit your assignment via Mimir, and you can testit by submitting your code. Note: for this assignment you are expected to installand use an IDE (other than Mimir) to develop your code. The problem in this assignmentis described in three stages. Each stage builds on the next. Each stagesubsumes the previous stage. I.e., if completing Stage III, means completing Stage II and Stage I.The Halifax International Airport is redesigning their Airport Security Screening facilities and are trying todetermine how many security check stations are needed. To determine this, they have hired you to writea simulation to determine how long it takes passengers to get through a security check. In real life, thetotal time depends on many Factors, such as the number of stations there are, the number of bags apassenger has, the number of passengers arriving at security, and whether some passengers pack prohibiteditems, requiring a manual Search of their bags. To keep things simple, you have decided to start witha simple simulation and increase its complexity from one stage to the next. You have noted that thefactors that contribute most to the wait time are: waiting to enter the station and waiting to collect thebags after they have gone through the scanner, with the occasional manual inspection to slow thingsdown. Naturally, a passenger cannot collect their bags until the passenger ahead of them has done so.Write a program called AirportSecuritySim.java that simulates an Airport Security Checkpoint.Each simulation consists of several rounds. In each round zero or more passengers arrive at the airportsecurity checkpoint, each carrying zero or more bags. They are assigned to a screening station with theshortest line. They then Wait zero or more rounds for their turn to place their bags on the conveyor belt,walk through the scanner, and collect their bags on the other side before leaving to catch their flight. Yourprogram will simulate this process, outputting when the passengers arrive and when they leave.Stage I: Airport Security SimplifiedIn this stage, all passengers will be travelling light, i.e., they will have no bags and there is only one screeningstation that is operational.InputThe input is divided into two parts: (i) a list screening stations that are open at the security check pointand (ii) a list of passengers arriving in each round. The first part of the input isthe list of screening stations.The first part is a single line that contains an integer denoting the number of stations (S), followed by Sintegers encoding the stations numbers that are open. For example, this input3 2 4 8means there are 3 open screening stations: 2, 4, and 8. In Stage 1, only one station will be open.The second part of the input is the list of the passengers and their bags arriving in each round. The firstline contains a Single integer (R) denoting the number of rounds in which passengers may be arriving. Thisis followed by R sections, one section per round. Each section begins with a line containing a single integer(P) denoting the number of passengers arriving at the security check point in this round. This is followedby P lines encoding each passenger and their bags. In Stage 1, each passenger is encoded by a singleword, denoting the passengers name followed by a 0, indicating the passenger has 0 bags. E.g., the input52Alice 0Bob 001Carol 03Dave 0Eve 0Fred 01Ginny 0means there are 5 rounds: In round 1, Alice and Bob arrive, each carrying 0 bags; in round 2, no passengersarrive; in round 3, Carol arrives, with no bags; in round 4 Dave, Eve, and Fred arrive; and in round 5, Ginnyarrive, also with no bags. In Stage 1 all passengers carry 0 bags, which makes the screening a little faster.ProcessingYour program should simulate the operations of the security checkpoint. The main loop performs oneround per iteration. The pseudocode for your main program is:1. Read in the screening stations and the number of rounds2. Loop for the specified number of rounds:a. Read in the passengers arriving in this round. For each passengeri. Read in the bags that they are carrying (in Stage 1 no one has bags)ii. Assign each passenger to a screening station.iii. Generate the required output for the passenger (see Output Section).b. For each screening stationi. The passenger at the head of the line proceeds through the screening and leavesii. Generate the required output for the passenger (see Output Section)3. Loop until all the passengers have left the security checkpointa. For each screening stationi. The passenger at the head of the line proceeds through the screening and leavesii. Generate the Required output for the passenger (see Output Section)OutputWhen a passenger enters a screening station line, the program should output:Name(B) enters station N in round Twhere Name is the passengers name B is the number of bags the passenger has N is the Station they have been assigned to T is the current round. Rounds are numbered 1, 2, 3, RWhen a passenger leaves a screening station line, the program should output:Name(B) leaves station N in round TThe output should be to the console, and each line terminated by a newline. If two passengers are arrivingor leaving at the same time, the output should be the same as the input order.Alice(0) enters station 7 in round 1Bob(0) enters station 7 in round 1Alice(0) leaves station 7 in round 1Bob(0) leaves station 7 in round 2Carol(0) enters station 7 in round 3Carol(0) leaves station 7 in round 3Dave(0) enters station 7 in round 4Eve(0) enters station 7 in round 4Fred(0) enters station 7 in round 4Dave(0) leaves station 7 in round 4Ginny(0) enters station 7 in round 5Eve(0) leaves station 7 in round 5Fred(0) leaves station 7 in round 6Ginny(0) leaves station 7 in round 7Hints and SuggestionsYou can implement this assignment as you wish, however, the following design is recommended: Passenger classo name : String passengers nameo + Passenger(String) sets the name of the passengero + getName() : String returns the name of the passengero + toString() : String returns a String of the form Name(numberOfBags) ScreeningStation classo lineup : QueuePassenger queue of passengers waiting to be screenedo stationNumber : int number of screening Stationo + ScreeningStation(int) sets the station numbero + addPassenger(Passenger) : void adds passenger to lineupo + getStationNumber() : int returns station numbero + getLineUpSize() : int : returns number of passengers in line-upo + isPasengersInStations() : boolean returns true if there are passengers in the stationo + doStep() : Passenger returns a passenger that has just left the station, or null if no passengerhas left the station. AirportSecuritySim class Implements the pseudocode in the Processing sectiono Create Passenger objects as you are reading in the arriving passengers in the main loop.Stage II: Multiple Screening StationsExtend your program from Stage I to handle multiple screening stations.InputThe input format is the same as in Stage I.ProcessingYour program Should perform the same task as in Stage I with the following assumptions The number of screening stations may be greater than 1. For each passenger select the station with the fewest number of passengers. If there is a tie, theorder of the stations breaks the tie. In the main loops, stations are processed in the order that they were read in.OutputThe output format is the same as in Stage I.Hints and SuggestionsTo extend Stage 1 the following design additions are recommended: AirportSecuritySim class : add functionality to create and store multiple ScreeningStation objectso Use an array or an ArrayList to store the ScreeningStation objectsStage III: The Full ProgramExtend your program from Stage II to handle baggage. Passengers can bring zero or more bags. Whilemost bags will pass through the screening stations X-ray machine untouched, some bags will need to beexamined by security personnel before being collected by the passenger. This will result in delays.InputThe input format is the same as in Stage I. Additionally, if a passenger has more than 0 bags, the formatfor the passenger is:Name B M1 M2 MBwhere Name is the name of the passenger B is the number of bags Mi is a Boolean value indicating if the ith bag requires manual screening. The value false meansthat no manual inspection is needed and the value true means that a manual screening isneeded. (See example.)ProcessingYour program should perform the same task as in Stage II with the following additions When a passenger is screened, the passengers bags are screened as well. For each bag that requires manual screening, the passenger is delayed a round and cannot leave. No following passengers can leave the same station until the passenger whose bags are beingmanually Screened leaves.OutputThe output format is the same as in Stage I and II.ExamplesExample 1Input Output2 7 4252Alice 2 true trueBob 1 false01Carol 3 true true true3Dave 2 false trueEve 1 falseFred 01Ginny 0Alice(2) enters station 7 in round 1Bob(1) enters station 42 in round 1Bob(1) leaves station 42 in round 1Carol(3) enters station 42 in round 3Alice(2) leaves station 7 in round 3Dave(2) enters station 7 in round 4Eve(1) enters station 7 in round 4Fred(0) enters station 42 in round 4Ginny(0) enters station 7 in round 5Dave(2) leaves station 7 in round 5Eve(1) leaves station 7 in round 6Carol(3) leaves station 42 in round 6Ginny(0) leaves station 7 in round 7Fred(0) leaves station 42 in round 7Hints and SuggestionsTo extend Stage 2 to Stage 3 the following design additions are recommended Bag classo manualScreening : boolean does the bag require manual screeningo + Bag(boolean) sets whether the bag requires manual screeningo + isManualScreening() : boolean returns whether the bag requires manual screening Passenger class : add the following attributeso bags : ListBag a list used to store the passengers bags (used in latero + addBag(Bag) : void adds a bag to the passenger (will not be needed until Stage 2)o + getNumberOfBags() : int returns the number of bags a passenger haso + getBags() : ListBag returns the list of bags a passenger has ScreeningStation classo + doStep() : Passenger this method will need to be modified to deal with passengers thathave bags. AirportSecuritySim class : add functionality to read in the bags for each passengero Use the Scanners nextBoolean() method to read the Boolean values of the bagsGradingThe assignment will be graded based on three criteria:Functionality: Does it work according to specifications?. This is determined in an automated fashion byrunning your program on a number of inputs and ensuring that the outputs match the expected outputs.The score is determined based on the number of tests that your program passes. So, if your programpasses t/T tests, you will Receive that proportion of the marks.Quality of Solution: Is it a good solution? This considers whether the approach and algorithm in yoursolution is correct. This is determined by visual inspection of the code. It is possible to get a good gradeon this part even if you have bugs that cause your code to fail some of the tests.Code Clarity: Is it well written? This considers whether the solution is properly formatted, well documented,and follows coding style guidelines. A single overall mark will be assigned for clarity. Please seethe Java Style Guide in the Assignment section of the course in Brightspace.If your program does not compile, it is considered non-functional and of extremely poor quality, meaningyou will receive 0 for the solution.The following grading scheme will be used:Task 100% 80% 60% 40% 20% 0%Functionality(20 marks)Equal to the number of tests passed.Solution Quality(20 marks)Approach and algorithmare appropriateto meetRequirements forStage IIIApproach and algorithmare appropriateto meet requirementsforStage II, but notStage IIIApproach and algorithmare appropriateto meet requirementsforStage I but notStage IIApproach andalgorithm willmeet some ofthe requirementsof Stage IApproachis correctbut algorithmis incorrectNo code submitted or code is not areasonable attemptCode Clarity(10 marks)Indentation, formatting,naming,commentsCode looks professionaland followsall style guidelinesCode looks goodand mostly followsstyle guidelines.Code is mostlyreadable andmostly followsSome of the styleguidelinesCode is hard toRead and followsfew of the styleguidelinesCode is illegibleWhat to Hand InThis assignment must be submitted in Mimir via the Brightspace page.Hints and Things to Remember Use LinkedList for Queues to store passengers. All input will be correct. You do not need to handle incorrect input, for now.如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。