Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi I need help with this program can someone please help me thank you The following (unfinished) program implements a digital line queuing system for

Hi I need help with this program can someone please help me thank you

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. ' # Add rider to line '(2) Reserve place in VIP line. ' # Add VIP '(3) Dispatch riders. ' # Dispatch next ride car '(4) Print riders. ' '(5) Exit. ')

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)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Discuss the Hawthorne experiments in detail

Answered: 1 week ago

Question

Explain the characteristics of a good system of control

Answered: 1 week ago

Question

State the importance of control

Answered: 1 week ago

Question

What are the functions of top management?

Answered: 1 week ago