Question: Step 5 : Implement the SwapCommand class and GroceryList's swap _ with _ undo ( ) method Implement the SwapCommand class in SwapCommand.py . The
Step : Implement the SwapCommand class and GroceryList's swapwithundo method
Implement the SwapCommand class in SwapCommand.py The class itself is declared, but no attributes yet exist. Add necessary attributes and methods so that the command can undo swapping two items in the grocery list.
Implement GroceryList's swapwithundo method. The method swaps list items at the specified indices, then pushes a SwapCommand, to undo that swap, onto the undo stack.
Step : Implement the InsertAtCommand class and GroceryList's removeatwithundo method
Implement the InsertAtCommand class in InsertAtCommand.py Add necessary fields and methods so that the command can undo removing a grocery list item at an arbitrary index.
Implement GroceryList's removeatwithundo method. The method removes the list item at the specified index, then pushes an InsertAtCommand, to undo that removal, onto the undo stack.
qxzqy
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
