Question

In: Computer Science

You will create a program that will follow the queuing theory of the Barbershop Problem. You...

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

  1. Couch - the area where patron will wait just prior to getting their hair cut;
  2. Line - the area where patron will form a line just before reaching the couch; and
  3. Cashier - the area where patrons will line up to pay just before exiting the barbershop and after finishing their haircut.  

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.

  • 1 second (system time) = 5 minutes
  • Max time 2 hours
  • Min time 20 minutes.

Cashier wait time

  • 1 second (system time) = 1 minute
  • Max time 3 minutes
  • Min time 1 minute.

IN PYTHON AND NOT QUIZ

Solutions

Expert Solution

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


Related Solutions

You will create a program that will follow the queuing theory of the Barbershop Problem. You...
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 Couch - the area where patron will wait just prior to getting their hair cut; Line - the area where patron will form a line...
(JAVA PLS)You will create a program that will follow the queuing theory of the Barbershop Problem....
(JAVA PLS)You will create a program that will follow the queuing theory of the Barbershop Problem. In this you will use ques and random number generator to complete this project. You will create three queues Couch - the area where patron will wait just prior to getting their hair cut; Line - the area where patron will form a line just before reaching the couch; and Cashier - the area where patrons will line up to pay just before exiting...
What can managers do with queuing theory? Multiple Choice Create better marketing Calculate net profits Eat...
What can managers do with queuing theory? Multiple Choice Create better marketing Calculate net profits Eat at fancy restaurants Measure and predict performance Utilization is equal to which of the following? Multiple Choice Arrival rate times service rate Service rate divided by arrival rate Arrival rate divided by service rate Service rate minus arrival rate The second, simpler formula is only valid for which condition? Multiple Choice The arrival and service rates are derived from a Beta distribution The arrival...
Problem Description A local veterinarian at The Pet Boutique has asked you to create a program...
Problem Description A local veterinarian at The Pet Boutique has asked you to create a program for her office to create invoices for her patient’s office visits. When a customer brings their pet to the boutique, the clerk gets the Customer’s name, address, phone number and email address, as well as the pets name, pet type, pet age, and pet weight. After the customer sees the Veterinarian, the clerk determines the charges for the services, and medications for the office...
Write a javascript program according to the follow requirements: Create a function that converts Fahrenheit to...
Write a javascript program according to the follow requirements: Create a function that converts Fahrenheit to Celsius. It takes a single argument which represents degrees in Fahrenheit. It converts it and returns the degrees in Celsius. Create another function that converts Celsius to Fahrenheit. It takes a argument in Celsius and returns the degrees in Fahrenheit. Implement the function convert(isFtoC, from, to) below. It takes the following three arguments: isFtoC: a boolean that is true if degrees must be converted...
hello, I need a python program for a drone to follow keyboard commands - Create a...
hello, I need a python program for a drone to follow keyboard commands - Create a simple single obstacle environment and program the drone to navigate through it - Create a more advanced obstacle environment (3+ obstacles) and program the drone to navigate through it
a) Create a program for the msp430FR6989 .You will use need to program it to be...
a) Create a program for the msp430FR6989 .You will use need to program it to be able to use a external pulse switch to start/stop the blinking of LED1, and a second pulse switch to control the blinking of LED2. b) Modify Program #1 (b) to blink the number of times on the data switches once the pulse switch is engaged
Queuing Theory Priest Mulcahy currently uses two confessionals with separate rows to serve the needs of...
Queuing Theory Priest Mulcahy currently uses two confessionals with separate rows to serve the needs of his parishioners. Arrivals have been found to be random, at an average rate of 30 people per hour, and service time tends to be random as well, since the number of sins per person can differ greatly. The average time spent in the confessional has been determined to be 3 minutes. It has also been obtained that arrivals are distributed equally between the two...
Create a C program that simulates time-sharing in the operating system. Please follow the instructions provided:...
Create a C program that simulates time-sharing in the operating system. Please follow the instructions provided: a) Use a circular queue. b) It is required that the process be inputted by the user. The user must input the process name and the duration in seconds, and for this simulation let the user input 5 processes. c) As this requires process name and duration, use an array of structures. d) To simulate time-sharing, following the algorithm presented below: d.1) Use the...
Queuing theory should be used to study problems involving people, materials, equipment or vehicles form waiting...
Queuing theory should be used to study problems involving people, materials, equipment or vehicles form waiting lines. What are some of the reasons this is so important in the study of systems?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT