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('{} person(s) waiting:'.format(len(line)), line)       else:         print('Unknown menu option')       user_input = input('Enter command: ').strip().lower()     print(user_input)

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

zyDE 6.2.1: Amusement park ride reservation system.

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('{} person(s) waiting:'.format(len(line)), line)

 

    else:

        print('Unknown menu option')

 

    user_input = input('Enter command: ').strip().lower()

    print(user_input)

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Parallel Processing
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY