Review
Write a program that creates a window, and colors the left half
of the window red, and the right half green.
Write a function called "add" that takes in two integers, x and y.
It should add them together and return the result. Test your function.
Create an array of integers containing 1, 4, 6, 1, 10, and 5.
Next, write a loop that goes over the array and adds all the numbers together.
It should print the sum of all the numbers.
[HINT! You'll need a variable to add all the numbers to]
Classes
Create a class called Color that has three integers, r, g, and b.
Create your setup and draw functions. Set the window size to whatever you want.
Create three global Color objects. Call them x, y, and z.
In the setup function, set the "r", "g", and "b" properties of x, y, and z
to be random. Use = (int) random(255); for this
In the draw function, create a random integer. Use (int) random(3) for this.
If the random number is 0, draw the background using the r, g, and b from the x object.
If the random number is 1, draw the background using the r, g, and b from the y object.
If the random number is 2, draw the background using the r, g, and b from the z object.
Congratulations, your screen should now flash randomly, choosing one of three random colors.