Question: I need help creating this java program thank you in advance. 1. Define a class named Color that contains three private int instance variables, representing

I need help creating this java program thank you in advance.
 I need help creating this java program thank you in advance.
1. Define a class named Color that contains three private int instance

1. Define a class named Color that contains three private int instance variables, representing the red, green, and blue components that make up the color. Each variable has a value between 0 and 255 (inclusive), representing the contribution of that color component to the overall color (for example, a red value of 200 would mean a high amount of red in the color, while a blue value of 50 would represent a low amount of blue in the color). The class also has a private String instance variable that represents the name of the color (e.g., "salmon" or "teal"). The Color class has a constructor that takes three integer arguments, representing the color's red, green, and blue components; it assigns the value null (NOTE: this is a literal value, NOT the string "null") to the color name. A second constructor takes three integers and a String as arguments, and assigns them to the appropriate instance variables. Finally, the class has public accessor methods for all four variables 2. Next, define a subclass of Color named AlphaChannelcolor.An AlphaChannelcolor has one additional private instance variable: an integer that represents the color's degree of transparency (0 is fully opaque, and 255 is fully transparent). Define two constructors for this class; one takes four integers representing the red, green, blue, and opacity values, while the second constructor also takes a String argument representing the name of the color (note that each constructor will need to invoke one of the superclass constructors as its first line) Finally, override the getColorName() accessor method that you inherited from Color as follows: The new version of getcolorName () should return the name of the color prefixed by either "opaque", "semi-transparent", or "transparent" (e.g., "opaque teal"). Hint: use Color's getColorName() method to get the original name. a. b. If the transparency value is less than 100, the prefix should be "opaque". If it is between 100 and 199, the prefix should be "semi-transparent. If the transparency value is 200 or greater, the prefix should be "transparent" c. If the color name is null, substitute "color" for the color name (e.g., "semi transparent color")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!