Question: Consider the partial class declarations below. public class Pixel { / / instance variables and / / constructors not shown public int getRed ( )

Consider the partial class declarations below.
public class Pixel {
// instance variables and
// constructors not shown
public int getRed(){...}
public int getGreen(){...}
public int getBlue(){...}
public void setRed(int value){...}
public void getGreen(int value){...}
public void getBlue(int value){...}
// other methods not shown
}
public class ImagePlus {
private Pixel[][] pixels;
// other instance variables,
// constructors, and methods not shown
//to be implemented
public void darkerDarks(){...}
}
We want to add a method to the ImagePlus class called darkerDarks(). This method would change all Pixel objects with an average amount of RGB less than 25 to a completely black Pixel. In other words, if the average of red, green, and blue in a Pixel object is less than 25, the red, green, and blue values would be changed to zero. This would happen for all Pixel objects in the ImagePlus object.
RGB values before calling darkerDarks()
RGB values after calling darkerDarks()
Example #1
(10,20,30)
(0,0,0)
Example #2
(25,25,25)
(25,25,25)
Example #3
(0,0,74)
(0,0,0)
Example #4
(42,185,76)
(42,185,76)
public void darkerDarks(){

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!