Bouncing Balls

Write a class named BouncingBall that allows one to construct a ball, whose position, size, and related breadboard can be initially set. One should also be able to get the x and y coordinates of the center of the ball at any time, as well as get and/or set the x and y velocities (i.e., horizontal and vertical velocities) of the ball. With each tick of the associated breadboard timer, the position and velocity should be updated in a reasonable way to reflect the physics of the situation. Included in this is that when the ball "strikes" the floor, walls, or ceiling of the central drawing region, it should "bounce" in a reasonable way. The speed of the ball should remain constant, however.

Then, write a class named BouncingBallsAnimator that extends the TwoButtonBreadboard of the breadboards package. Upon entering some number of balls in the text field at the bottom of the breadboard window, and clicking the "Go" button, the same number of balls with randomly chosen initial positions, velocities, sizes, and colors will bounce perpetually off the sides of the central area of the window. Note: while the balls should bounce off of the sides -- for this program, the balls should not bounce off of each other. Instead, two balls that appear headed for collision should appear to pass "through" one other, as if one of the balls was closer to the viewer than the other. Clicking the "Stop" button should remove all of the balls from the screen.