Question: Air-Traffic Control-queue using a linked list. Need assistance in coding in PlaneQueue.py. 4.12 LAB: Air-traffic control (queue using a linked list) Given a partial main.py

4.12 LAB: Air-traffic control (queue using a linked list) Given a partial main.py and PlaneQueue class in PlaneQueue.py, write the push() and pop() instance methods for PlaneQueue Then complete main py to read in whether flights are arriving or have landed at an airport An arriving flight is pushed onto the queue A landed fight is popped from the front of the queue Output the queue after each plane is pushed or popped. Entering -1 exits the program Click the orange triangle next to "Current file at the top of the editing window to view or edit the other files. Note. Do not edit any existing code in the files. Type your code in the TODO sections of the files only, Modifying any existing code may result in failing the auto graded tests Ex If the input is arriving AA213 arriving DAL23 arriving 12628 landed -1 the output is Air-traffic control queue Next to land: AA213 Air-traffic control queue Next to land: AA213 Arriving lights: DAL 23 Ar-traffic control queue Next to land: A1213 Arriving lights: DAL 04628 AA23 has landed. Air traffic control queue Next to land: DAL 23 Arriving lights UA620 Current file PlaneQueue.py Load default template. 1 from Planelist import PlaneList 2 3 class PlaneQueue: 4 def __init__(self) 5 self.plane_list - Planelist 6 self.length 7 8 # TODO: Write push and pop instance methods. push adds an item to the queue 9 + and adds 1 to length pop removes and returns the first item in 10 + the queue and subtracts 1 from length. 11 12 13 def is empty(self): 14 return self length - 15 16 def print_queue(self): 17 print'Air-traffic control queue') 18 if not self is empty: 19 print("Next to land, end='') 20 cur_node - self.plane_list.head 21 cur_node.print_node_data() 22 print 23 24 if self.length > 1: 25 print Arriving flights:') 26 cur.node - cur_node.next 22 while cur node is not None 28 print end.') 29 cur.node.print_node_dato 30 print) 31 cur.node - cur..node.next 32 else 33 print('Queue is empty. 34 print
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
