首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
CSCI 1110讲解、data留学生编程辅导、Java程序语言调试 讲解R语言编程|解析Haskell程序
项目预算:
开发周期:
发布时间:
要求地区:
CSCI 1110: Assignment 4
Due: 8:00 am, Tuesday, November 24, 2020
The purpose of this assignment is to reinforce your understanding of linear data
structures such as lists and queues. For this problem you will be provided with sample
tests in Mimir. All input is done via the console and all output is to be done to
the console as well. You must submit your assignment via Mimir, and you can test
it by submitting your code. Note: for this assignment you are expected to install
and use an IDE (other than Mimir) to develop your code. The problem in this assignment
is described in three stages. Each stage builds on the next. Each stage
subsumes 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 to
determine how many security check stations are needed. To determine this, they have hired you to write
a simulation to determine how long it takes passengers to get through a security check. In real life, the
total time depends on many factors, such as the number of stations there are, the number of bags a
passenger has, the number of passengers arriving at security, and whether some passengers pack prohibited
items, requiring a manual search of their bags. To keep things simple, you have decided to start with
a simple simulation and increase its complexity from one stage to the next. You have noted that the
factors that contribute most to the wait time are: waiting to enter the station and waiting to collect the
bags after they have gone through the scanner, with the occasional manual inspection to slow things
down. 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 airport
security checkpoint, each carrying zero or more bags. They are assigned to a screening station with the
shortest 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. Your
program will simulate this process, outputting when the passengers arrive and when they leave.
Stage I: Airport Security Simplified
In this stage, all passengers will be travelling light, i.e., they will have no bags and there is only one screening
station that is operational.
Input
The input is divided into two parts: (i) a list screening stations that are open at the security check point
and (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 S
integers encoding the stations numbers that are open. For example, this input
3 2 4 8
means 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 first
line contains a single integer (R) denoting the number of rounds in which passengers may be arriving. This
is 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 followed
by P lines encoding each passenger and their bags. In Stage 1, each passenger is encoded by a single
word, denoting the passenger’s name followed by a 0, indicating the passenger has 0 bags. E.g., the input
5
2
Alice 0
Bob 0
0
1
Carol 0
3
Dave 0
Eve 0
Fred 0
1
Ginny 0
means there are 5 rounds: In round 1, Alice and Bob arrive, each carrying 0 bags; in round 2, no passengers
arrive; in round 3, Carol arrives, with no bags; in round 4 Dave, Eve, and Fred arrive; and in round 5, Ginny
arrive, also with no bags. In Stage 1 all passengers carry 0 bags, which makes the screening a little faster.
Processing
Your program should simulate the operations of the security checkpoint. The main loop performs one
round per iteration. The pseudocode for your main program is:
1. Read in the screening stations and the number of rounds
2. Loop for the specified number of rounds:
a. Read in the passengers arriving in this round. For each passenger
i. 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 station
i. The passenger at the head of the line proceeds through the screening and leaves
ii. Generate the required output for the passenger (see Output Section)
3. Loop until all the passengers have left the security checkpoint
a. For each screening station
i. The passenger at the head of the line proceeds through the screening and leaves
ii. Generate the required output for the passenger (see Output Section)
Output
When a passenger enters a screening station line, the program should output:
Name(B) enters station N in round T
where
• Name is the passenger’s 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, … R
When a passenger leaves a screening station line, the program should output:
Name(B) leaves station N in round T
The output should be to the console, and each line terminated by a newline. If two passengers are arriving
or leaving at the same time, the output should be the same as the input order.
Alice(0) enters station 7 in round 1
Bob(0) enters station 7 in round 1
Alice(0) leaves station 7 in round 1
Bob(0) leaves station 7 in round 2
Carol(0) enters station 7 in round 3
Carol(0) leaves station 7 in round 3
Dave(0) enters station 7 in round 4
Eve(0) enters station 7 in round 4
Fred(0) enters station 7 in round 4
Dave(0) leaves station 7 in round 4
Ginny(0) enters station 7 in round 5
Eve(0) leaves station 7 in round 5
Fred(0) leaves station 7 in round 6
Ginny(0) leaves station 7 in round 7
Hints and Suggestions
You can implement this assignment as you wish, however, the following design is recommended:
• Passenger class
o – name : String passenger’s name
o + Passenger(String) sets the name of the passenger
o + getName() : String returns the name of the passenger
o + toString() : String returns a String of the form “Name(numberOfBags)”
• ScreeningStation class
o – lineup : Queue
queue of passengers waiting to be screened
o – stationNumber : int number of screening Station
o + ScreeningStation(int) sets the station number
o + addPassenger(Passenger) : void adds passenger to lineup
o + getStationNumber() : int returns station number
o + getLineUpSize() : int : returns number of passengers in line-up
o + isPasengersInStations() : boolean returns true if there are passengers in the station
o + doStep() : Passenger returns a passenger that has just left the station, or null if no passenger
has left the station.
• AirportSecuritySim class Implements the pseudocode in the Processing section
o Create Passenger objects as you are reading in the arriving passengers in the main loop.
Stage II: Multiple Screening Stations
Extend your program from Stage I to handle multiple screening stations.
Input
The input format is the same as in Stage I.
Processing
Your 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, the
order of the stations breaks the tie.
• In the main loops, stations are processed in the order that they were read in.
Output
The output format is the same as in Stage I.
Hints and Suggestions
To extend Stage 1 the following design additions are recommended:
• AirportSecuritySim class : add functionality to create and store multiple ScreeningStation objects
o Use an array or an ArrayList to store the ScreeningStation objects
Stage III: The Full Program
Extend your program from Stage II to handle baggage. Passengers can bring zero or more bags. While
most bags will pass through the screening station’s X-ray machine untouched, some bags will need to be
examined by security personnel before being collected by the passenger. This will result in delays.
Input
The input format is the same as in Stage I. Additionally, if a passenger has more than 0 bags, the format
for the passenger is:
Name B M1 M2 … MB
where
• 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 means
that no manual inspection is needed and the value true means that a manual screening is
needed. (See example.)
Processing
Your program should perform the same task as in Stage II with the following additions
• When a passenger is screened, the passenger’s 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 being
manually screened leaves.
Output
The output format is the same as in Stage I and II.
Examples
Example 1
Input Output
2 7 42
5
2
Alice 2 true true
Bob 1 false
0
1
Carol 3 true true true
3
Dave 2 false true
Eve 1 false
Fred 0
1
Ginny 0
Alice(2) enters station 7 in round 1
Bob(1) enters station 42 in round 1
Bob(1) leaves station 42 in round 1
Carol(3) enters station 42 in round 3
Alice(2) leaves station 7 in round 3
Dave(2) enters station 7 in round 4
Eve(1) enters station 7 in round 4
Fred(0) enters station 42 in round 4
Ginny(0) enters station 7 in round 5
Dave(2) leaves station 7 in round 5
Eve(1) leaves station 7 in round 6
Carol(3) leaves station 42 in round 6
Ginny(0) leaves station 7 in round 7
Fred(0) leaves station 42 in round 7
Hints and Suggestions
To extend Stage 2 to Stage 3 the following design additions are recommended
• Bag class
o – manualScreening : boolean does the bag require manual screening
o + Bag(boolean) sets whether the bag requires manual screening
o + isManualScreening() : boolean returns whether the bag requires manual screening
• Passenger class : add the following attributes
o – bags : List
a list used to store the passenger’s bags (used in later
o + 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 has
o + getBags() : List
returns the list of bags a passenger has
• ScreeningStation class
o + doStep() : Passenger this method will need to be modified to deal with passengers that
have bags.
• AirportSecuritySim class : add functionality to read in the bags for each passenger
o Use the Scanner’s nextBoolean() method to read the Boolean values of the bags
Grading
The assignment will be graded based on three criteria:
Functionality: “Does it work according to specifications?”. This is determined in an automated fashion by
running 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 program
passes 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 your
solution is correct. This is determined by visual inspection of the code. It is possible to get a good grade
on 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 see
the 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, meaning
you 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 algorithm
are appropriate
to meet
requirements for
Stage III
Approach and algorithm
are appropriate
to meet requirements
for
Stage II, but not
Stage III
Approach and algorithm
are appropriate
to meet requirements
for
Stage I but not
Stage II
Approach and
algorithm will
meet some of
the requirements
of Stage I
Approach
is correct
but algorithm
is incorrect
No code submitted or code is not a
reasonable attempt
Code Clarity
(10 marks)
Indentation, formatting,
naming,
comments
Code looks professional
and follows
all style guidelines
Code looks good
and mostly follows
style guidelines.
Code is mostly
readable and
mostly follows
some of the style
guidelines
Code is hard to
read and follows
few of the style
guidelines
Code is illegible
What to Hand In
This 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
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做ceng0013 design of a pro...
2024-11-13
代做mech4880 refrigeration a...
2024-11-13
代做mcd1350: media studies a...
2024-11-13
代写fint b338f (autumn 2024)...
2024-11-13
代做engd3000 design of tunab...
2024-11-13
代做n1611 financial economet...
2024-11-13
代做econ 2331: economic and ...
2024-11-13
代做cs770/870 assignment 8代...
2024-11-13
代写amath 481/581 autumn qua...
2024-11-13
代做ccc8013 the process of s...
2024-11-13
代写csit040 – modern comput...
2024-11-13
代写econ 2070: introduc2on t...
2024-11-13
代写cct260, project 2 person...
2024-11-13
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!