Question: In this problem you will write a Rainbow class which will draw a rainbow at a specified (x, y). Rainbow will have a construct that

In this problem you will write a Rainbow class which will draw a "rainbow" at a specified (x, y).

Rainbow will have a construct that takes the x, y coordinates of the upper-left hand corner of the rainbow as well as the height of a color.

Rainbow will have a draw method which takes the graphical context as a parameter and draws the rainbow.

The rainbow will be displayed as colored rectangles rather than arcs. The height of a rectangle is given in the constructor. The width of a rectangle is 5 times the height of a rectangle. The colors of the first 5 should be made with the pre-defined colors in the Color class. Use red, orange, yellow, green, and blue in that order. The next color is indigo and has RGB values (75, 0, 130). The last rectangle is violet with RGB values of (143, 0, 255). You will need to construct Color objects using these values. There are 7 rectangles.

You will complete the RainbowComponent class to construct and draw three Rainbow objects given these criteria

Upper left-hand corner at 0,0. Height of 20

Upper left-hand corner at 100, 180. Height of 10

Upper left-hand corner at 0, 200. Height of 5

RainbowViewer is provided.

Using Java language, thank you

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!