Draw a rainbow-use what you know about colors, pixels, and drawing operations to draw a rainbow.
What will be an ideal response?
```
public void drawRainbow ( )
{
Graphics g = this.getGraphics ( ) ;
int height = this.getHeight ( ) ;
int width = this.getWidth ( ) ;
int diff = width / 15 ;
int halfDiff = diff / 2 ;
int x = 0 ;
int y = 0 ;
// draw the red arc
g . set Color ( Color .RED) ;
g . fil lArc (x , y , width , height , 0 , 1 8 0 ) ;
// draw the orange arc
width = width - diff ;
height = height - diff ;
x = x + halfDiff ;
y = y + h alfDiff ;
g . set Color (new Color ( 255, 102, 0 ) ) ;
g. fill Arc (x , y , width , height , 0 , 180 ) ;
// draw the yellow arc
width = width - diff ;
height = height - diff ;
x = x + halfDiff ;
y = y + halfDiff ;
g. set Color (Color .YELLOW) ;
g. fill Arc (x , y , width , height , 0 , 180 );
// draw the green arc
width = width - diff ;
height = height - diff;
x = x + half Diff;
y = y + half Diff;
g. set Color (Color .GREEN) ;
g. fill Arc (x , y , width , height , 0 , 1 8 0 ) ;
// draw the blue arc
width = width - diff;
height = height - diff ;
x = x + halfDiff ;
y = y + halfDiff ;
g. set Color ( Color .BLUE) ;
g. fill Arc (x , y , width , height , 0 , 180 ) ;
// draw the purple arc
width = width - diff ;
height = height - diff ;
x = x + halfDiff ;
y = y + halfDiff ;
g. set Color (new Color ( 153 , 0 , 204 ) ) ;
g. fill Arc (x , y , width , height , 0 , 180 ) ;
// draw the white arc
width = width - diff;
height = height - diff;
x = x + halfDiff ;
y = y + halfDiff ;
g. set Color ( Color .WHITE) ;
g. fill Arc (x , y , width , height , 0 , 180 ) ;
}
```
You might also like to view...
____ compression discards data and can reduce image quality.
A. Paint B. Lossless C. Lossy D. Generation
Antivirus software scans virus signatures in e-mail attachments, ____, and files that you access from USB flash drives, CDs, DVDs, or the Web.
A. uploads B. copies C. backups D. downloads
A quantity field would be best formatted as the ________ data type
Fill in the blank(s) with correct word
Two vertices that are joined by an edge are said to be ______ each other.
a) related to b) bordering c) utilizing d) adjacent to