Back to 211 Main Page

Mobius strip

Assignment 2

The Assignment

http://learnu.ics.hawaii.edu/~nickles/211_support/labs/banana_split_chef.htm

Submission

  • Email your assignment to ztomasze@hawaii.edu.
  • 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.

Grading

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]
Bowl B: [whipped cream][cherry]
Bowl C: (empty)
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.
2 - Your algorith must be recursive and produce the correct output.

Solution

  • 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. :)


~ztomasze Index : TA Details: ICS211: Assignment 2
http://www2.hawaii.edu/~ztomasze
Last Edited: 19 Sept 2004
©2004 by Z. Tomaszewski.