Queue Programming Project
Description
Take the program and modify it by adding the missing Queue class (see Hint.png if you have trouble getting started) such that when the program is run, it produces the output as in the transcript below:
Queuing up G.Wash, J.Ad, T.Jeff, J.Mad, J.Mon
Presidents: [FIRST--> Washington, Adams, Jefferson, Madison, Monroe <--LAST]
Dequeue George -- first president in, so first one out
Presidents: [FIRST--> Adams, Jefferson, Madison, Monroe <--LAST]
Dequeue everybody
President dequeued: Adams
Presidents: [FIRST--> Jefferson, Madison, Monroe <--LAST]
President dequeued: Jefferson
Presidents: [FIRST--> Madison, Monroe <--LAST]
President dequeued: Madison
Presidents: [FIRST--> Monroe <--LAST]
President dequeued: Monroe
Presidents: [FIRST--> <--LAST]
Adding J.Ad, A.Jack, M.Van, B.Harr, J.Ty
Presidents: [FIRST--> Adams, Jackson, Van Buren, Harrison, Tyler <--LAST]
Adding J.Polk to the back of the line
Presidents: [FIRST--> Adams, Jackson, Van Buren, Harrison, Tyler, Polk <--LAST]
- – The constructor of the Queue class is correct.
- – The enqueue method of the Queue class is correct. The method adds an item to the queue.
- – The dequeue method of the Queue class is correct. The method removes and returns the item that has been in the queue the longest.
- – The is_empty method of the Queue class is correct. A queue is empty when it contains no items.
- – The __str__ method of the Queue class is correct.
- – In the main function, the statement presidents += “Polk” is implemented correctly using the appropriate magic method in the Queue class.
- – Add an is_equal method that compares two queues for equality. Add test code in the main function: compare two different queues with the same items in the same order (equal); also two different queues with same items/different orderings (not equal); and two queues with different items (not equal).
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."