Question: 2. This question is about the Composite and Iterator patterns.(10 points) The diagram on the left shows the composite pattern for a wizard's bag. Assume

 2. This question is about the Composite and Iterator patterns.(10 points)
The diagram on the left shows the composite pattern for a wizard's

2. This question is about the Composite and Iterator patterns.(10 points) The diagram on the left shows the composite pattern for a wizard's bag. Assume that the Wizard has several wizard bags which he can put inside each other (like Babushka dolls). Bags can contain other bags or loose items. He can make the entire contents of a bag or a single item disappear by saying the words: Evanesco Ocsenave Magicltems Wizarditems WizardBayg a. Write java-like pseudo code to for a method called disappear() to make the WizardBag and everything in it disappear. (3 points) b. Write java-like pseudo code for an external iterator class that iterates through all of the Wizarditems (i.e the leaf items only). You will get points for showing the main methods of the class (3 points), showing any data structure(s) needed in the class (1 points), and writing high quality pseudocode inside the methods of the class (3 points)

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