Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with creating a class. Requirements are below Part 3 - Creating a Waiter 0 Next, dene the Waiter class in a le

I need help with creating a class. Requirements are below

image text in transcribedimage text in transcribed
Part 3 - Creating a Waiter 0 Next, dene the Waiter class in a le titled Waiter . py. This class will make use of Menu and Diner objects, so be sure to include the proper import statements. 0 This class will represent the restaurant's waiter. The waiter maintains a list of the diners it is currently taking care of, and progresses them through the different stages of the restaurant. The waiter in the simulation will repeat multiple cycles of attending to the diners. In each cycle, the waiter will seat a new diner, if one arrives, take any diners' orders if needed, and give diners their bill, according to each diner's status. o The class will use the following instance attributes: 0 self. diners: a list of Diner objects the waiter is attending to 0 self. menu: a Menu object representing the restaurant's menu 0 Also dene the following methods: 0 _init_ I Inputs ii ):a Menu object I Return value: none I Assign the input parameter to the corresponding attribute. Initialize the list of diners to an empty list. 0 addDiner I Inputs (1 1: a Diner object I Return Value: none I Add the new Diner object to the waiter's list of diners. o getumDiners I m: none I Return Value: an integer representing the number of diners the waiter is currently keeping track of o printDinerStatuses I MM: none I Return Value: none I Print all the diners the waiter is keeping track of, grouped by their statuses. I Loop through each of the possible dining statuses a Diner might have (hint: use the Diner class attribute) to group the diners. o takeOrders I Inputs: none I Return Value: none I Loop through the list of diners and check if the diner's status is \"ordering\". I For each diner that is ordering, loop through the different menu types 0 With each menu type, print the menu items of that type, then ask the diner to order a menu item by selecting a number (be sure to include error checking). a After the diner selected a menu item, add the item to the diner. Once the diner orders one menu item of each type, print the diner's order. 0 Each diner must order exactly one item of each type. 0 ringUpDiner's Inputs: none Return Value: none Loop through the list ofdiners and check if the diner's status is \"paying". For each diner that is paying, calculate the diner's meal cost and print it out in a message to the diner. o removeDoneDiners MM: none Return Value: none Loop through the list ofdiners and check if the diner's status is \"leaving". For each diner that is leaving, print a message thanking the diner. Loop through the list of diners backwards. Hint: use a range-based for loop. For each diner that is leaving, remove the diner from the list. 0 advanceDiners Inputs: none Return Value: none This method allows the waiter to attend to the diners at their various stages as well as move each diner on to the next stage. First, call the printDinerStatuses( ) method. Then, in order, call the takeOr-der's ( ), ringUpDiner's( ), and removeDiner-s () methods. Finally, update each diner's status. 0 You do not need to dene any getters and setters for this class. 0 At this point, if your classes are all correctly implemented, you should be able to run the program in its entirety

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions