Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

What advice would you provide to Jennifer?

Answered: 1 week ago

Question

What are the issues of concern for each of the affected parties?

Answered: 1 week ago