Lab 7

Don't forget to complete the quiz first on Blackboard.

I've improved on the pieces of sample code from the pre-lab, but I'll need your help to finish building these classes.  Download the zip file with the classes, then add them to a new eclipse project in order to get started.  I think Canvas and Board should be good to go, but Square and Runner need some work before the program does what I want it to.

0. For up to zero points, submit code which is equivalent in functionality to the code provided.

1. For one point, implement methods to change the size and color of a Square object, and modify the Runner class to place the square in the top left corner, move it horizontally across the screen to the top right corner, stopping there, then change the size and the color of the Square object.

2. To earn the second point, the sequence must continue, where the Square object moves around the perimeter in a clockwise direction.

For example, starting in the upper-left corner, goes to the upper-right corner, then goes to the lower-right corner, then again to the upper-left corner, then repeats the cycle.

Loop forever, having the square continually circle the perimeter of the applet.  You don't need to change the size with every corner, but you should change the color, either randomly or in a sequence.

3. For one additional point of extra credit, repeat the above process in successive smaller traversal squares, spiraling in to the center of the board.  Each interior circuit of the spiral should be smaller by about one width of the square (10).

Although it won't get you another point, to make it even more special, figure out how many iterations it will take for the square to reach the center, and shrink the square by 1 about every tenth of that time to simulate distance, spiraling away.

Hints:  Check out the canvas class for the available colors.  They're all plain english strings.

           Figure out where the edges of the canvas are by placing the square in various locations before trying to code part 2.

           Part 3 can be very similar to part 2, or very different, depending on how you code it.  Both are valid, but if you're not using a loop variable as part of your argument to slowMoveHorizontal, you'll probably want to rethink your method.

Submission:

You may work with a partner, and we recommend you do so in order to complete the lab during the lab session.

Be sure to include all authors' names, as well as the hour of the lab.

Submit a .zip containing all 4 .java files (but none of the .class files) to blackboard within one hour of the start of your lab session.