Ask Question

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. 20 September, 19:28
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers