8A

Complete the application RandomSquares  which uses a loop to draw 25 squares with random length sides at random locations. Make the x coordinate a random number between 0 (inclusive) and 200 (exclusive), Make the y coordinate a random number between 0 and 300 (exclusive). This x,y is the upper left hand corner of the rectangle (square). Make the length of the sides a random value between 20 (inclusive) and 100 (exclusive). Declare and use constants for:

Some constants are already defined for you. You do the rest

In the starter file, I have created a Random object for you with a seed. Be sure to use it. Because of the seed, the Random object will produce the same sequence of numbers every time the program is run so your drawing will always look the same (and will pass Codecheck). Do not change the seed.

Generate the random values in this order: x coordinate, y coordinate, length of the side.

You must use a loop. Do not have 25 lines of code each of which draws a square

Draw the squares in green. After you have drawn all the squares, fill the largest square with blue. Use the predefined colors from the Color class. If more than one square has the largest side, use the first one with that side as the largest. You will need to keep track of the largest as you go.

You will need to import Dr. Horstmann's graphics package into your Bluej project.

For the draft, draw one random square in green using the predefined color from the Color class.

8A draft:
8A final:

8B

There is no start file this time. You create a class called PracticeWithArrayLists with a main method In the main method, do the following

Note: You must use an ArrayList and its methods. Do not fake it by just printing the correct strings. You will know how to use these methods in a situation where the output can not be faked.

Note: There is a version of remove method that will remove a specific object. Use that. Here is the code to remove target from the ArrayList called stuff

stuff.remove(target);

Note: To print an ArrayList, use its toString method like this

System.out.println(stuff);
For the draft,

8B draft:
8B final:

8C

Finish the class Rectangles. It contains methods that manipulate an ArrayList of Rectangles

Rectangles has an instance variable ArrayList<Rectangle> Call the instance variable list. It has a constructor that takes no parameters but initializes the instance variable to an empty ArrayList

It has methods

You will need to import the Udacity graphics package in order to use Rectangle

Provide Javadoc

Note that if you do not implement the methods in order, you may not get the expected results until all the methods are implemented

For the draft, implement the constructor and the add method

8C draft:
8C final: