logo Use SA10RAM to get 10%* Discount.
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Ashton HamiltonEnglish
(5/5)

641 Answers

Hire Me
expert
Varun JakkaScience
(/5)

714 Answers

Hire Me
expert
Mitchie SimaCriminology
(5/5)

918 Answers

Hire Me
expert
Robin HunterGeneral article writing
(5/5)

624 Answers

Hire Me
Python Programming

import random from collections import deque from time import sleep my_queue = deque([])

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

import random

from collections import deque

from time import sleep

 

my_queue = deque([])

 

def user_input():

    print("Menu")

    print("1. Register a customer")

    print("2. Call next customer")

    print("3. List customers in queue")

    print("0. Exit")

    menu_number = int(input("Please choose : "))

    if menu_number == 1:

        register_customer()

        user_input()

    elif menu_number == 2:

        call_customer()

        user_input()

    elif menu_number == 3:

        list_customers()

        user_input()

    elif menu_number == 0:

        return

 

def register_customer():

    customer_name = input("May I have your name please : ")

    if len(my_queue) == 0:

        

        my_queue.append({

        'customer': customer_name,'queue_no': random.randint(1,5)*100,'missedcalls': 0

    })

    else:

        my_queue.append({

        'customer': customer_name,'queue_no': my_queue[-1]['queue_no']+1 ,'missedcalls': 0

    })

    

def call_customer():

    customer_servedno = 0

    customer_served = []

    if len(my_queue) == 0:

        print("There are no customers in queue.")

    else:

        customer = my_queue.popleft()

        while customer_servedno >= 0 :

            print("Calling queue no" + "your waffle is ready")

            sleep(1)

            if random.randint(0,3) == 1:

                print (str(customer['queue_no']) +' '+ customer['customer'] +' ' + "has been served")

                customer_served.append(customer['customer'])

                customer_servedno += 1

            else:

                print("Has tried 3 times calling Queue number" + ' ' + str(customer['queue_no']))

                my_queue.append(customer)

                my_queue.append(customer['missedcalls']+1)

def list_customers():

    if len(my_queue) == 0:

        print("There are no customers in queue.")

    else:

        print("Queue Number\t" + my_queue['queue_no'] + "Customer Name\t" +  my_queue['customer'] + "No of missed calls\t" +  my_queue['missedcalls'])

user_input()

 

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

448 Experts Online