8A

Note

There is an error in the code you are given in codecheck for this problem. Just change this code

 public DiscoFloor(int x, int y, int width) //incorrect

to this

 public DanceFloor(int x, int y, int width) //correct

In this problem you will be drawing a dance floor that consists of 7 rows of (filled) colored circles. Each row contains 6 circles. Each circle touches all of its neighbors. Each circle is a random color: either red, green, blue, yellow, orange, and cyan. Complete the class DanceFloor. Use the constants defined for you in the starter code. You must use nested loops. No credit for simply drawing 42 separate circles

For the colors, use the Color constants in the Color class. (Color.RED etc)

The DanceFloor will have this constructor and these methods

There is trick you can use to determine which color to return. Notice each color has been assigned an integer 0 to 5. You can generate a random number between 0 (inclusive) and 6 (exclusive). If the random number is 0 (RED), return Color.RED. If the random number is 1 (GREEN), return Color.GREEN

You will need to import the graphics package into Bluej.

For the draft, provide a draw method that draws the first circle in each row starting at the given (x, y) coordinates in Color.BLUE. Implement randomColor to always return Color.BLUE.

The draft should look like this.

scrreen shot

The final should look like this

final

8A draft:
8A final:

8B

Complete the class called ArrayListVeggies. In the main method, do the following

Note: While it is possible to fake this assignment, I strong urge you not to do so. If you do not know how to do something, ask and find out. That way you will know what to do in a situation where the output can not be faked.

For the draft,

8B draft:
8B final:

8C

Finish the class ArrayListOfStrings. It contains methods that manipulate an ArrayList of Strings. It has an an instance variable, a ArrayList<String>. Call the instance variable list. The constructor takes no parameters but initializes the instance variable with a new ArrayList<String>()

The class has these methods:

Assume that none of the strings are empty.

I have provided a toString method to aid testing. (This is why the instance variable must be called list.)

For the draft, provide the constructor and the add()method. Code the other methods as stubs and provide Javadoc.

8C draft:
8C final: