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...


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()

May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here