Return to assignment description

Sample Output

The output below is from the complete program. Before Activity 5 is completed, Activity 1 should end with the message "Good! You noticed the end."

=== Activity 1 === Here is the bag: [bag, the, is, This] There is a "bag" in the Bag There is a "the" in the Bag There is a "is" in the Bag There is a "This" in the Bag There is nothing more in the Bag Didn't notice the extra thing in the bag... Good! You noticed that change! === Activity 2 === The bag is: [50, 42, 30, 20, 10] The first call to next returns 50 The second call to next returns 42 I will try to remove that. Good. That seems to have worked. The bag is now: [50, 30, 20, 10] The next item should be 30. Good! There should be two items remaining: 20 10 The bag is now: [50, 30, 20, 10] === Activity 3 === The bag is [30.3, 20.2, 10.1] Testing remove before next Good! correct exception thrown The bag should be unchanged: [30.3, 20.2, 10.1] Testing remove after remove The bag should be missing its 30.3: [20.2, 10.1] Good! correct exception thrown The bag is now: [20.2, 10.1] There should be two items remaining: 20.2 10.1 The Bag should now be empty: [] === Activity 4 === Here is the bag: [before, gone, has, one, no, where, go, boldly, to] Removing words 'go' 'no' 'so' 'to' and 'zo' Bag is now: [one, before, where, gone, boldly, has] Retaining words 'before' 'boldly' 'go' 'sleep' Bag is now: [boldly, before] === Activity 5 === Here is the bag: [5, 4, 3, 2, 1] Removing an item using it1 That seems to have worked The bag is now: [4, 3, 2, 1] Advancing using it1 That seemed to work -- got 4 Advancing using it2 Good! Noticed the external change Removing using it2 Good! Noticed the external change The bag is now: [4, 3, 2, 1] Advancing (again) using it1 That seemed to work -- got 3

Return to assignment description