CS46J

Remember not to create packages. Use the default package

2A

For this problem we are going to draw a "rainbow"

Getting Set Up

Project specification

Complete the RainbowComponent class. The application will draw rainbow will starting at (0,0). The colors will be displayed in rectangles rather than arcs. Each rectangle has a width of 100 and a height of 20. There are 7 rectangles. 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.

This is what the result will look like:

""

RainbowViewer is provided at the Codecheck URL

Codecheck URL

2B

Draw the word TWO using the Line2D.Double and Ellipse2D.Double classes in the Java library.

Make a project and create a class called TwoComponent to do the drawing. There is no starter file this time. But a TwoViewer class is provided

Your drawing should follow these specifications.

It is a good idea to figure out the coordinates of each letter before starting to draw. Trial and error is not efficient here.

Sample output

''

 

Codecheck URL

2C

In this application, you will draw a target consisting of three concentric circles

Follow these specifications

Sample output

''

Codecheck URL