In python Imagine that we are creating an app to manage the queue at the Secretary of State office. As customers arrive, they are added to the end of the queue. When workers are available to help the customers, they will call the name of the first person in the queue, and remove them from the queue. Another option for the app is to print out the entire queue so customers can see where they stand. The menu options are (1) Add a customer to the queue (2) Serve the customer (3) Print out the queue (4) Quit the application. At the beginning of the day, the queue is empty. When a customer is added to the queue, you will have to prompt for the customer's name. When a customer is served, you should print the message "Now serving customer Jon." if the first name in the queue is Jon, so Jon is called to the counter and removed from the queue. If the app user enters anything besides '1', '2', '3', or '4', you should print out the message "Unknown menu option." and display the menu again. When the user enters the option 4, the program should just exit without printing anything. NOTE: You should think about handling the case where the user tries to serve a customer when there are no customers in the queue. If that happens, you should print out the message "No customers to serve.". Get everything else working first, then work on that part. Following is an example run of what the program should look like after 'jon', 'ben', and 'anika' have already been added to the queue: (1) Add a customer to the queue. (2) Serve customer. (3) Print queue. (4) Exit. 1 What is the customer's name? bridget (1) Add a customer to the queue. (2) Serve customer. (3) Print queue. (4) Exit. 3 ['jon', 'ben', 'anika', 'bridget'] (1) Add a customer to the queue. (2) Serve customer. (3) Print queue. (4) Exit. 2 Now serving customer jon. (1) Add a customer to the queue. (2) Serve customer. (3) Print queue. (4) Exit. 3 ['ben', 'anika', 'bridget'] (1) Add a customer to the queue. (2) Serve customer. (3) Print queue. (4) Exit. 4 # initialize the queue to be empty menu = ('(1) Add a customer to the queue.\n' '(2) Serve customer.\n' '(3) Print queue.\n' '(4) Exit.\n\n') # print out the menu and get the user's input user_input = input(menu).strip().lower() # keep asking for the user's choice until they choose option 4. # INSERT CODE FOR THE APPROPRIATE WHILE CONDITION BELOW: # while user does not want to exit: # check each option and do the appropriate thing for each # INSERT CODE FOR ALL THE MENU OPTIONS HERE # print the menu again and get the next command user_input = input(menu).strip().lower()

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

In python

Imagine that we are creating an app to manage the queue at the Secretary of State office. As customers arrive, they are added to the end of the queue. When workers are available to help the customers, they will call the name of the first person in the queue, and remove them from the queue. Another option for the app is to print out the entire queue so customers can see where they stand.

The menu options are (1) Add a customer to the queue (2) Serve the customer (3) Print out the queue (4) Quit the application.

At the beginning of the day, the queue is empty. When a customer is added to the queue, you will have to prompt for the customer's name. When a customer is served, you should print the message "Now serving customer Jon." if the first name in the queue is Jon, so Jon is called to the counter and removed from the queue.

If the app user enters anything besides '1', '2', '3', or '4', you should print out the message "Unknown menu option." and display the menu again. When the user enters the option 4, the program should just exit without printing anything.

NOTE: You should think about handling the case where the user tries to serve a customer when there are no customers in the queue. If that happens, you should print out the message "No customers to serve.". Get everything else working first, then work on that part.

Following is an example run of what the program should look like after 'jon', 'ben', and 'anika' have already been added to the queue:

(1) Add a customer to the queue. (2) Serve customer. (3) Print queue. (4) Exit. 1 What is the customer's name? bridget (1) Add a customer to the queue. (2) Serve customer. (3) Print queue. (4) Exit. 3 ['jon', 'ben', 'anika', 'bridget'] (1) Add a customer to the queue. (2) Serve customer. (3) Print queue. (4) Exit. 2 Now serving customer jon. (1) Add a customer to the queue. (2) Serve customer. (3) Print queue. (4) Exit. 3 ['ben', 'anika', 'bridget'] (1) Add a customer to the queue. (2) Serve customer. (3) Print queue. (4) Exit. 4

# initialize the queue to be empty


menu = ('(1) Add a customer to the queue.\n'
'(2) Serve customer.\n'
'(3) Print queue.\n'
'(4) Exit.\n\n')

# print out the menu and get the user's input
user_input = input(menu).strip().lower()

# keep asking for the user's choice until they choose option 4.

# INSERT CODE FOR THE APPROPRIATE WHILE CONDITION BELOW:
# while user does not want to exit:
# check each option and do the appropriate thing for each

# INSERT CODE FOR ALL THE MENU OPTIONS HERE


# print the menu again and get the next command
user_input = input(menu).strip().lower()

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education