In: Computer Science
You will create a program that will follow the queuing theory of the Barbershop Problem. You will initially create a flow chart for the assignment to be uploaded to the Queuing Theory Flowchart assignment drop box. In this you will use queues and random number generators to complete this project. You will create three queues
You will create a container for the barbers chairs (list) . The wait times for the barbers will be random. Barber one will be the fastest and barber three will be the slowest. Randomize the wait times accordingly.
The cashier wait times will also vary randomly.
Barber wait times.
Cashier wait time
IN PYTHON AND NOT QUIZ
Flowchart of Barbershop Problem:Code: def barber(): name = input("What's your name?:") print("Hi", name, "!") choice = random.choice("+x") finish = False quesno = 0 correctques = 0 while finish == False: if 0 <= quesno < 10: no1 = random.randrange(1, 10) no2 = random.randrange(1, 10) print((no1), (choice), (no2)) ans = int(input("What's the answer?:")) quesno = quesno + 1 if choice == ("+"): realans = no1 + no2 if ans == realans: print("That's the correct answer!") correctques = correctques + 1 # print(correctques) if correctques == 10: finish = True else: print("That's incorrect!,the answer was", realans, "!") elif choice == ("x"): realans = no1 * no2 if ans == realans: print("That's the correct answer!") correctques = correctques + 1 #print(correctques) if correctques == 10: finish = True else: print("That's incorrect!,the answer was", realans, "!") elif choice == ("-"): realans = no1 - no2 if ans == realans: print("That's the correct answer") correctques = correctques + 1 #print(correctques) if correctques == 10: finish = True else: print("That's incorrect!,the answer was", realans, "!") else: finish = True else: finish = True print("Good Job", name, "! You have finished the quiz") barber()
Code Image:
Output:
Please give me an upvote if my answer helped :)