Your program should display a window filled with five vertical color bars of equal size. The left and right color bars should be the color of one of the static fields of the Color class (Color.black, Color.blue, Color.cyan, etc.). The bar in the middle should be a 50%-50% blend of the right and left color bars. The center right and center left color bars should be 75%-25% blend of the right and left color bars (switching which is 75% and which is 25% to create two different colors).
In order to accomplish this you will need to interpolate colors, which can be acheived by interpolating each of the rgb values that constitute a color. In order to linearly interpolate two numbers you can use the following equation:
xi = x1 * (p1 / 100.0) + x2 * (p2 / 100.0)Where xi is a value that is p1 percent of x1 and p2 percent of x2. Note that p1 and p2 must sum to 100.
As usual, use good programming techniques. You should use good variable names, constants where appropriate, whitespace, and correct indentation and alignment of statements. Be sure to put your name, the file name, and a description of the program in the header. The program should be broken up into logical sections and each section should be documented with a brief description of what it does.
Submission
From your postlab4 directory, tar your code using the command:
tar czf username.tgz ClassName.javaWhere username is the name you use to log into the lab machines and ClassName is the name of the file that contains your java code.
To submit your code, copy the tar file containing your code to the directory:
~bouchard/cpsc120/post4