Page 1 of 1

Develop a console program using Python. ● Draw program's flowchart. Write a Python program to create a simple queue syst

Posted: Thu Jun 02, 2022 7:45 am
by answerhappygod
Develop A Console Program Using Python Draw Program S Flowchart Write A Python Program To Create A Simple Queue Syst 1
Develop A Console Program Using Python Draw Program S Flowchart Write A Python Program To Create A Simple Queue Syst 1 (160.3 KiB) Viewed 16 times
def new_ticket():


global next_ticket

global tickets
tickets.append(next_ticket)

next_ticket+=1
def assign_counter(option):


global counter

global tickets
key = "Counter "+ str(option)

counter[key] = tickets.pop(0)



tickets = []
counter = {'Counter 1':'Not assigned','Counter 2':'Not
assigned',

'Counter 3':'Not assigned','Counter 4':'Not
assigned',}
next_ticket = 1001
print("Enter 0 to 5 for following options:")

print("0 -> Issue new ticket number.")
print("1 -> Assign first ticket in queue to counter 1.")
print("2 -> Assign first ticket in queue to counter 2.")
print("3 -> Assign first ticket in queue to counter 3.")
print("4 -> Assign first ticket in queue to counter 4.")
print("5 -> Quit program")
while(True):


print("\nTickets in queue:",tickets)

print("Counter assignment:",counter)

option = int(input("Enter your option: "))


if option == 0:


new_ticket()

elif option>0 and option<5:


assign_counter(option)

elif option == 5:


print("Quitting
program...\n>>>")
break

else:


print("Invalid option, try
again...")
Develop a console program using Python. ● Draw program's flowchart. Write a Python program to create a simple queue system to manage customer flow in a bank. There are four service counters in the bank. The program must have all functions listed in below: 1. Function to issue new ticket with new number auto increase by 1, start from 1001. 2. Function to assign first ticket in queue to selected service counter, from 1 to 4. Upon program start, the program should display message as shown in picture below: Output example Enter 0 to 5 for following options: 0 -> Issue new ticket number 1 -> Assign first ticket in queue to Counter 1 2 -> Assign first ticket in queue to Counter 2 3-> Assign first ticket in queue to Counter 3 4 -> Assign first ticket in queue to Counter 4 5-> Quit program Tickets in queue: [] Counter assignment: {"Counter 1': 'Not assigned', Counter 2': 'Not assigned', 'Counter 3': 'Not assigned', 'Counter 4': 'Not assigned'} Enter your option: |