ram 2: BACK AWAY FROM THE TV! If you sat close enough to an old TV, you could see individual (R)ed, (G)reen and (B)lue (or RGB) “phosphors” that could represent just about any color you could imagine (using “additive color model”). When these three-color components are at their maximum values, the resulting color is white from a distance (which is amazing – look at your screen with a magnifying glass!). When all are off, the color results in black. If red and green are fully on, you’d get a shade of yellow; red and blue on would result in purple, and so on. For computers, each color component is usually represented by one byte (8 bits), and there are 256 different values (0-255) for each. To find the “inverse” of a color (like double-clicking your iFone® button), you subtract the RGB values from 255. The “luminance” (or brightness) of the color = (0.2126*R + 0.7152*G + 0.0722*B). For this program, you need to design (pseudocode) and implement (source code) a Color class that has R, G and B attributes (which can be ints). The constructor should take three parameters representing the initial color of (R:254, B:2, G:100). You should include 6 setter methods to increase and decrease each component (e.g. increaseRed), not to exceed 255 or be less than 0. You should include a toString() that returns a string representing the current values for each component as well as the luminance. Finally, you should include a method that calculates and prints the inverse color. Next, create a “driver” (or main) that creates a default color, prints its values to the screen, and enables the user to increase/decrease values as well as print the inverse.
ram 2: BACK AWAY FROM THE TV! If you sat close enough to an old TV, you could see individual (R)ed, (G)reen and (B)lue (or RGB) “phosphors” that could represent just about any color you could imagine (using “additive color model”). When these three-color components are at their maximum values, the resulting color is white from a distance (which is amazing – look at your screen with a magnifying glass!). When all are off, the color results in black. If red and green are fully on, you’d get a shade of yellow; red and blue on would result in purple, and so on. For computers, each color component is usually represented by one byte (8 bits), and there are 256 different values (0-255) for each. To find the “inverse” of a color (like double-clicking your iFone® button), you subtract the RGB values from 255. The “luminance” (or brightness) of the color = (0.2126*R + 0.7152*G + 0.0722*B). For this program, you need to design (pseudocode) and implement (source code) a Color class that has R, G and B attributes (which can be ints). The constructor should take three parameters representing the initial color of (R:254, B:2, G:100). You should include 6 setter methods to increase and decrease each component (e.g. increaseRed), not to exceed 255 or be less than 0. You should include a toString() that returns a string representing the current values for each component as well as the luminance. Finally, you should include a method that calculates and prints the inverse color. Next, create a “driver” (or main) that creates a default color, prints its values to the screen, and enables the user to increase/decrease values as well as print the inverse.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images