Question: Challenge: 1. Now that you have a functioning action tracker that allows users to add actions the next step is to add the ability

 

Challenge: 1. Now that you have a functioning action tracker that allows

Challenge: 1. Now that you have a functioning action tracker that allows users to add actions the next step is to add the ability to undo those actions. To do this you'll need to add the following: a. A method public UserAction RemoveAction() i. This method will, if the Action Stack is not empty (use NextEmptySpotIndex to check this similar to how we checked if the array was full), remove the top most action from the ActionStack. (The reverse of adding). It will need to set the Has Changed field to true since we made a change to the Action Stack. This method has to return the UserAction object that was removed from the ActionStack. This removed UserAction will be used by the code that called RemoveAction. b. You'll notice after creating the RemoveAction method that the displayed list doesn't change. To see that list get smaller you'll need to add code in DisplayActions that will clear all of the spaces that the DisplayActions can write to (think using a loop here) by writing over them with empty lines - before the tracked actions are displayed. (Below saving off the starting cursor position and above the first SetCursorPosition call from the guided portion of the assignment). 2. Testing a. Uncomment the following lines in Program.cs 1. Highlight the line/lines and use ctrl +k, ctrl + U ii. 42, 69-73, 89, 99-123 b. Once that is completed you should be able to press Q to quit, A to add Actions to the tracker and U to undo the most recent action in the tracker. You'll see the Action list grow and shrink depending on which buttons you press and you'll see the last action removed displayed next to the action list.

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 Programming Questions!