subject

The following (unfinished) program implements a digital line queuing system for an amusement park ride. The system allows a rider to reserve a place in line without actually having to wait. The rider simply enters a name into a program to reserve a place. Riders that purchase a VIP pass get to skip past the common riders up to the last VIP rider in line. VIPs board the ride first. (Considering the average wait time for a Disneyland ride is about 45 minutes, this might be a useful program.) For this system, an employee manually selects when the ride is dispatched (thus removing the next riders from the front of the line). Complete the following program, as described above. Once finished, add the following commands:
The rider can enter a name to find the current position in line. (Hint: Use the list. index() method.)
The rider can enter a name to remove the rider from the line.

riders_per_ride = 3 # Num riders per ride to dispatch
line = [] # The line of riders
num_vips = 0 # Track number of VIPs at front of line
menu = ('(1) Reserve place in line.\n' # Add rider to line
'(2) Reserve place in VIP line.\n' # Add VIP
'(3) Dispatch riders.\n' # Dispatch next ride car
'(4) Print riders.\n'
'(5) Exit.\n\n')
user_input = input(menu).strip().lower()
while user_input != '5':
if user_input == '1': # Add rider
name = input('Enter name:').strip().lower()
print(name)
line. append(name)
elif user_input == '2': # Add VIP
print('FIXME: Add new VIP')
# Add new rider behind last VIP in line
# Hint: Insert the VIP into the line at position num_vips.
#Don't forget to increment num_vips.
elif user_input == '3': # Dispatch ride
print('FIXME: Remove riders from the front of the line.')
# Remove last riders_per_ride from front of line.
# Don't forget to decrease num_vips, if necessary.
elif user_input == '4': # Print riders waiting in line
print('%d person(s) waiting:' % len(line), line)
else:
print('Unknown menu option')
user_input = input('Enter command: ').strip().lower()
print(user_input)

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 06:30, arguellesjavier15
Who can provide you with a new password when you have forgotten your old one? your provide you with a new password in case you forget your old one.
Answers: 3
image
Computers and Technology, 23.06.2019 16:00, cravens511peeelg
An english teacher would like to divide 8 boys and 10 girls into groups, each with the same combination of boys and girls and nobody left out. what is the greatest number of groups that can be formed?
Answers: 2
image
Computers and Technology, 24.06.2019 14:00, MK100
What are the different components of the cloud architecture?
Answers: 2
image
Computers and Technology, 24.06.2019 21:30, asimms8504
Suppose a router has built up the routing table shown in the table. subnet number 128.96.39.00 28.96.39.128 128.96.40.00 192.4.153.0 default) subnet mask 255.255.255.128 255.255.255.128 255.255.255.128 255.255.255.192 nexthop interface 0 interface 1 r2 r3 r4. the router can deliver packets directly over interfaces 0 and 1, or it can forward packets to routers r2, r3, or r4. describe what the router does with a packet addressed to each of the following destinations: (a) 128.96.39.10 (b) 128.96.40.12 (c) 128.96.40.151 (d) 192.4.153.17 (e) 192.4.153.90
Answers: 3
You know the right answer?
The following (unfinished) program implements a digital line queuing system for an amusement park ri...

Questions in other subjects: