- Email your assignment to email@example.com.
- Attach the source code of your Java application. Send me only the source code (.java files); do not include the .class or any other files. Do not zip or otherwise bundle the .java files.
This assignment will be out of 10 points. You will get points for the following:
- 2 - Compiles and runs.
- Remember to send me all the .java files needed to compile and run your program.
- 2 - Coding style and documentation.
- You need to follow ICS's Java Coding Standards and document your code as described here.
- 2 - You must model the bowls and ingredients using appropriate data structures.
- The bowls should be some sort of container, such as an array, a Vector, a Stack, or a class. Ingredients can be ints, Strings, objects, or some other primitive.
- 2 - Your output must clearly show the steps taken by your algorithm.
- One way to do this would be to print each move:
Moved bananas from bowl A to bowl C.
Another way would be to print the state of all three bowls after each move:
Bowl A: [ice cream][bananas][pineapple]
Or you may choose some other form (even an applet), as long as I can recreate the moves of your program based on its output.
Bowl B: [whipped cream][cherry]
Bowl C: (empty)
- 2 - Your algorith must be recursive and produce the correct output.
- Zach's Solution. I was playing around with overriding classes here. I wrote the a TowersOfHanoi class and then overrode it to provide the BananaSplit output. I also wrote my Tower/Bowl to complain if a large Disk/Ingredient was ever placed on top of a smaller one. As it turned out, I didn't need this code at all. A lesson in not writing code until you're sure you'll need it, I guess. :)