Question: Language: Python Write a Queue class. The class is detailed as follows: __init__(self, capacity) None oComplexity: O(1) oValid Input: An integer in (0, ]. Use

Language: Python

Write a Queue class. The class is detailed as follows: __init__(self, capacity) None oComplexity: O(1) oValid Input: An integer in (0, ]. Use a default, valid capacity on invalid input. oThis is the constructor for the class. You will need to store the following here: The head pointer The tail pointer A variable maxSize A variable currentSize Any other instance variables you want. enqueue(self, ticket) boolean oComplexity: O(1) oValid Input: An object of type: MealTicket. Return False on invalid input. oThis is the enqueue method. It will add a meal ticket to the queue. It will then return True/False depending on if the enqueue was successful (Hint: Add a new ticket at the tail of the queue). dequeue(self) MealTicket/ boolean oComplexity: O(1) oThis is the dequeue method. It will remove the ticket at the front of the queue andreturn it or False if the queue is empty. (Hint: Dequeue a ticket at the head of theQueue). front(self) MealTicket/ boolean oComplexity: O(1) oThis method lets the user peak at the ticket at the front of the queue without deleting it. It will either return a meal ticket or false if the queue is empty. isEmpty(self) boolean oComplexity: O(1) oThis method will return True/False depending on if the queue is empty or not. isFull(self) boolean oComplexity: O(1) oThis method will return True/False depending on if the queue is full or not,

Note: See Figure 1 at the bottom of this section for a sample test run of the Queue class. Your program must perform exactly as shown in the figure. Note 2: All methods in the queue classhave a hard complexity upper bound of O(1). Your implementation must be in O(1).

Language: Python Write a Queue class. The class is detailed as follows:

c. Administrator. CA Windows System32\cmd.exe C:\Users\Faust\Google Drive \JH-Repo UOGEXCIS 313 - Vinter 2819\Lahs\Lab 1>python lab1.py === Testing Queue === Test 1: Queue Empty/Full Result: True False Test 2: Enqueue ing tickets until full. Result: True Result: True Result: Irue Result: True Result: False Test 3: Queue front and Enpty Full Result: The ticket at the front of the queue is: 1 Test 3: dequeue ing tickets until enpty. === Displaying Ticket == Ticket Name: Jared's Breakfast Ticket ID: 1 Total Cost: 8.0 Ticket Itens : Iten name : Eggs Item cost: 4.5 Iten name : Bacon -- Iten cost: 2.5 Iten name : OJ -- Iten cost: 1.8 - End -- === Displaying Ticket === Ticket Name: Jared's Lunch Ticket ID: 2 Total Cost: 18.49 Ticket Itens: Iten name Steak -- Iten cost: 14.99 Iten name: Salad -- Iten cost: 3.9 Iten name : Lychee -- Iten cost: 3.5 ========== End SEEEEE==== --- Displaying Ticket --- Ticket Name: Jared's Dinner Ticket ID: 3 Total Cost: 37.48 Ticket Itens: Item name: Noodles -- Item cost: 11.5 Iten name: Dumplings Item cost: 5.99 Item name: Whiskey -- Iter cost: 19.99 ========== End ========= - Displaying Ticket - Ticket Name: Jared's Snacks Ticket ID: 4 Total Cost: 16.25 Ticket Itens: Iten name Dragon Fruit Iten costs 8.5 Item name: Strawberry -- Iten cost: 3.25 Item name: Passion Fruit - Iter cost: 4.5 EEEEE End ========= Queue Empty: De queue Failed Queue_empty/full result: True --- End Testing ==== False C:\Users\Faust Google Drive VJH-Repo UONGEWCIS 313 - Vinter 2019\Labs Lab 1)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!