Ask Question
19 July, 03:26

A Color class has three public, integer-returning accessor methods: getRed, getGreen, and getBlue, and three protected, void-returning mutator methods: setRed, setGreen, setBlue, each of which accepts an integer parameter and assigns it to the corresponding color component. The class, AlphaChannelColor- - a subclass of Color- - has an integer instance variable, alpha, containing the alpha channel value, representing the degree of transparency of the color. AlphaChannelColor also has a method named dissolve (void-returning, and no parameters), that causes the color to fade a bit. It does this by incrementing (by 1) all three color components (using the above accessor and mutator methods) as well as the alpha component value. Write the dissolve method.

+1
Answers (1)
  1. 19 July, 03:56
    0
    The following code are:

    public void dissolve () {

    setRed (getRed () + 1);

    setGreen (getGreen () + 1);

    setBlue (getBlue () + 1);

    alpha+=1;

    }

    Explanation:

    Here, we define the void type function "dissolve () " inside it, we set three function i. e, "setRed () ", "setGreen () ", "setBlue () " and then we increment the variable "alpha" by 1.

    Inside those three mutators method we set three accessor methods i. e, "getRed () ", "getGreen () ", "getBlue () " and increment these accessor by 1.

    The values will not be returned by the mutator functions, the accessor will be returned the values.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “A Color class has three public, integer-returning accessor methods: getRed, getGreen, and getBlue, and three protected, void-returning ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers