Question: 4 . 2 6 LAB: Grocery list editor with undo stack In this lab a grocery list editor with undo functionality is implemented. Step 1
LAB: Grocery list editor with undo stack
In this lab a grocery list editor with undo functionality is implemented.
Step : Inspect the UndoCommand abstract base class
The readonly UndoCommand. py file has a declaration for the UndoCommand abstract base class. Ac on the orange arrow next to
main.py at the top of the coding window. The UndoCommand class repres that stores all needed information to execute an action at a later point in time. For this lab, a command grocery list change made by the user.
Step : Inspect the incomplete GroceryList class
The GroceryList class is declared in
GroceryList.py Two attributes are declared:
A list of strings for list items
A stack of UndoCommand references for undo commands
A simple list implementation of stack ADT is provided in
Stack.py
Note that the addwithundo method is already implemented. The method adds a new item to the list a RemoveLastCommand object onto the undo stack.
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
