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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:00
The word ‘play’ comes with many different interpretations and a variety of definitions. discuss some of the various meanings tied to the word play. why is the concept of play thought to be an important addition to the workplace? do some (brief) research online and give an example of how play in the workplace is being done right.
Answers: 2
question
Computers and Technology, 22.06.2019 22:30
Jason needs to learn a new web tool. he went through his books to understand more about it. now he wants hands-on experience with using that tool. what would him? jason can use websites where workspace is provided to test the results of your code.
Answers: 2
question
Computers and Technology, 24.06.2019 01:30
Write a program that asks the user to enter the name of an input file. if the file does not exist, the program should prompt the user to enter the file name again. if the user types quit in any uppercase/lowercase combinations, then the program should exit without any further output.
Answers: 3
question
Computers and Technology, 24.06.2019 16:50
Develop the program incrementally: a) start by reading and displaying each line of the input file to make sure you are reading the data set correctly. b) use the split string method to extract information from each line into a list. print the list to prove that this step is working correctly. d) convert the exam scores to type int and calculate the student’s average. display those items to prove this step is working correctly. e) create a tuple containing the six items for each student (name, exam scores, exam mean). display the tuples to prove this step is working correctly. (optionally, you may want to have the exam scores in a list so your tuple is (name, scores_list, f) append each tuple to a list. display the list to prove this step is working correctly. g) use the sort list method to re-order the tuples in the list. display the list to prove this step is working correctly. h) use a for statement to display the contents of the list as a table (with appropriate formatting). i) use a for statement to calculate the average of all scores on exam #1, then display the results. note that you could have calculated this average within the first loop, but we are explicitly requiring you to do this calculation by looping though your list of tuples. j) add the logic to calculate the average of all scores on exam #2, then display the results.
Answers: 2
You know the right answer?
The following (unfinished) program implements a digital line queuing system for an amusement park ri...
Questions
question
Physics, 24.04.2021 09:40
question
Computers and Technology, 24.04.2021 09:40
question
Social Studies, 24.04.2021 09:40
question
Mathematics, 24.04.2021 09:40
question
Mathematics, 24.04.2021 09:40
question
Mathematics, 24.04.2021 09:40
question
Mathematics, 24.04.2021 09:40
Questions on the website: 13722361