Write a version that only decreases the red by 10%, and one that reduces red by 20%. Which seems to be more useful? Note that you can always repeatedly reduce the redness in a picture, but you don't want to have to do it too many times, either.

What will be an ideal response?

```
public void decreaseRed10P ( )
{
Pixel [ ] pixelArray = this.getPixels ( ) ;
int red = 0 ;
// loop through all the pixels
for ( Pixel currPixel : pixelArray )
{
red = c urrPixel . getRed ( ) ;
currPixel . setRed ( ( int ) ( red ยค 0 . 9 ) ) ;
}
}
public void decreaseRed20P ( )
{
{Pixel [ ] pixelArray = this.getPixels ( ) ;
int red = 0 ;
// loop through a ll the pixels
for ( Pixel currPixel : pixelArray )
{
red = currPixel.getRed ( ) ;
currPixel.setRed ( ( int ) ( red *0 . 8 ) ) ;
}
}
```

Computer Science & Information Technology

You might also like to view...

Variables that are associated with an object are called properties or attributes.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

What is a firewall?

What will be an ideal response?

Computer Science & Information Technology