CS46A Fall 18

8A

Write a class RandomPlayer which performs some tests using a Random object.

RandomPlayer has this constructor:

It has these methods

Provide Javadoc

For the draft: provide the constructor. In the average method, just generate and return the first random int. Provide the setIterations method.

8A draft:
8A final:

8B

Avengers is a universe of characters created by Marvel. They first appeared as comic books and are now in movies.

There is no starter file this time. You create a class called AvengersList with a main method. It has no instance variables. 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 need to 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 in the [xxx, yyy, ...] format, use its toString method like this

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

 

8B draft:
8B final:

8C

Write a SimpleLineManager class which manages SimpleLine objects. A SimpleLine represents a line in 2-d space. It is simpler than the one in the graphics library. Copy it into your project. You can look at the documentation for the class by opening the class in the editor window. On the right-hand side where it says "Source Code", click the down arrow and select "Documentation."

The SimpleLineManager has an instance variable ArrayList<SimpleLine>. Call the instance variable lines. It has a no-argument constructor (That means it takes no parameters) which initializes an ArrayList to an empty ArrayList of SimpleLines.

Provide these method

Provide Javadoc

For the draft, define the instance variable and implement the constructor. Also implement the add method.

8C draft:
8C final: