Write a method to keep just the blue color. This means to set all the green and red values to zero.

What will be an ideal response?


```
/**
* Method to keep only the blue in a picture
*/
public void keepBlue ( )
{
Pixel [ ] pixelAr ray = this . getPixels ( ) ;
int value = 0 ;
for ( Pixel currPixel : pixelArray )
{
value = currPixel . getGreen ( ) ;
currPixel . setColor (new Color ( 0 , 0 , value ) ) ;
}
}
```
Write a method to keep just the red color.
```
public void keepRed ( )
{
Pixel [ ] pixelAr ray = this . getPixels ( ) ;
int red = 0 ;
for ( Pixel currPixel : pixelArray )
{
red = currPixel. getRed ( ) ;
currPixel . s e tColor (new Color ( red , 0 , 0 ) ) ;
}
}
```
Write a method to keep just the green color.
```
/**
* Method to keep only the green in a picture
*/
public void keepGreen ( )
f
Pixel [ ] pixelArray = this . getPixels ( ) ;
int value = 0 ;
for ( Pixel currPixel : pixelArray )
f
value = currPixel . getGreen ( ) ;
currPixel . setColor (new Color ( 0 , value , 0 ) ) ;
}
}
```

Computer Science & Information Technology

You might also like to view...

The code that is used to represent glyphs or syllables or whole words is:

A) block sequence. B) Unicode. C) mnemonic code. D) significant-digit.

Computer Science & Information Technology

The best starting point to developing a presentation is to ____.

A. establish why the presentation is needed B. analyze the intended audience C. decide what to include in the presentation D. gather information

Computer Science & Information Technology

A network uses this to send information between two networks and ensures the quickest path for sending information:

A) Wi-Fi B) VPN C) ICS D) router

Computer Science & Information Technology

The do while statement ends with what character?

A. comment B. semicolon C. colon D. ending brace

Computer Science & Information Technology