Project 8 -- bouncing balls.


NOTE: Exercise X8 is merely a warm-up exercise,
to be replaced and superseded by project 8.

You may do exrcise X8 with or without classes, but
but project 8 must use Object-Oriented classes, as described.

Exercise X8:   Billiards (pool) table, with three bouncing balls.

A light-blue, rectangular table, occupies most of the screen.
Three colored balls (RED, GREEN, BLUE), each with random horizontal and vertical velocities (dx and dy), bounce off the boundaries (left, top, right, bottom) of the rectangle.
	... 
	    [image goes here] 
	                      ....


When the mouse is clicked INSIDE the button, re-start all three balls at the left side, EACH one with a random height and random velocities (dx and dy).
Also, respond as follows when a key is pressed:

Display a (rectangular) button.
     The first time this button is clicked, change the table to another color;
     if it is clicked again, change table back to original color.
(Original color, if clicked an even number of times; otherwise, use the new color.)
If your name is NOT " "Smith" ",
please enter your name below:


Project 8:     Use a   Ball   class      and a   Button   class.

Define a class named "Ball" (with a Capital "B"), with appropriate properties and methods, and redo Project 8 (as "Project 9") using this class (instead of global variables and functions).

Each instance of a Ball should be named with the color (red, green, blue) followed by your own Last name. (You may shorten your name to four or more letters, if you wish.) If your Last name is "Smith" (or "Smithinghamsky.) then the instances should be named:

Also create a class named "Button" (with a Capital "B"), and make four buttons, displaying the following text and performing the following actions when clicked: The "Button" class should have the following properties and methods:
    	// Button coordinates:  x,y
    	// Button shape:	1 for circle, 2 for rectangle, 3 for triangle, etc.
    	// Button dimensions:	width & height for rectangle, etc.
    	// Button color.
    	// Button text.
    	// Other properties, as necessary.
    
    void show() {
    // Display this button.

    boolean isHit( float x, float y ) {
    // Return "true" if (x,y) is within this button's shape.



.  
.  
.  
For Project 9, create an array of ten Ball objects,
each with different colors, positions, speeds, etc.

Also, create an array of 5 (or more) Button objects, each with different properties.