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.getGraphi c s ( ) ;
int he i ght = this.getHe ight ( ) ;
int width = this.getWidth ( ) ;
int diff = width / 1 5 ;
int halfDiff = diff / 2 ;
int x = 0 ;
int y = 0 ;
// draw the red arc
g . s e tColor ( Color .RED) ;
g . f i l lArc (x , y , width , height , 0 , 1 8 0 ) ;
// draw the orange arc
width = width - diff ;
he i ght = height - d i f f ;
x = x + halfDiff ;
y = y + h alfDiff ;
g . s e tColor (new Color ( 255, 102, 0 ) ) ;
g . fill Ar c (x , y , width , height , 0 , 180 ) ;
// draw the yellow arc
width = width - diff ;
height = height - diff ;
x = x + halfDiff ;
y = y + halfDiff ;
g . setColor (Color .YELLOW) ;
g . fillArc (x , y , width , height , 0 , 180 ) ;
```
You might also like to view...
A program with a benign capability that conceals another, sinister purpose is called a
a. hack. b. rogue. c. Trojan horse. d. virus. e. worm.
Once a notebook has been shared, it can be moved to a different location
Indicate whether the statement is true or false
________ options include left, right, justified, and centered
Fill in the blank(s) with correct word
Pressing the _____ key(s) removes the marquee from the source area.
A. TAB B. CTRL+X C. CTRL+V D. ESC