No, not the towers in Middle Earth. Nor the ones in Hanoi. This assignment requires you to define and use Iterators. You will find the necessary background and considerably helpful suggestions and hints in your text, Chapter 8 and especially Section 8.7 Laboratory: The Two-Towers Problem
However, pay attention to the instructions given here as I am superseding several of the requirements. (Remember my suggestions for success -- “follow instructions”.) Even if you perfectly implement the problem as specified in the book, you will lose credit if you do not attend to the modifications to the instructions given below. The SubsetIterator class you write should use generics and generic Vectors. You will actually use a specific type of Vector, perhaps Integer but I'm not saying; however, your SubsetIterator should take a generic Vector and return subsets one at a time.
Follow the instructions given in the text on pages 175-177 except as follows:
Using your SubsetIterator. With your SubsetIterator class in hand, write a program (another class called TwoTowers) that solves the Two-Towers problem. Note: in order to support the solution of the problem, you will probably want to write additional methods besides the ones prescribed above. For example, you might want a method that computes the sum of the contents of a Vector. It is sufficient for your solution to print out the box sizes in the two partitions, together with their respective sums and a total difference between the two towers.
I want all of you to at least consider the "Thought Questions" found at the end of the project in your text. I intend to assign either a lab or a homework that is related to the thought questions of this project so I want you to have thought about the issues.
[optional] If you implement (and test and document) the randomSubset() method and use it to generate an approximate solution, you will get extra credit.
Do not forget to use the javadoc constructs for your documentation and include the html file produced by the javadoc tool in your final submission. Make sure that you create a folder named with your Westmont email name followed by “HW5”. For example, someone with email address “cjones” would create a folder called “cjonesHW5”. Make sure that inside that folder you have: for both parts of the assignment, java source files and html documentation files (and necessary resources) resulting from javadoc. Finally, either tar or zip the folder so that when we extract it, the folder “<emailname>HW5” will be created. Submit the packaged file for Exercise 5 on Eureka.