[exit Q&A]

Questions and Answers
I really don’t know where to get started. Could you give me an idea of what the format should look like, possibly in the first void pic1() part?

The first picture can be obtained by having a for loop executing 10 iterations.

The body of the loop should include a

g.drawLine(...)

instruction for drawing a line.

To find out the exact format of drawLine, find out what is the class type of g, and then visit the web page describing that type.

Just wondering why the g.drawRect(int, int, int, int) method won’t work. I put in integer values for x, y, height, and width, but it still wouldn’t draw the rectangles.

Probably the values of the arguments are inappropriate.

I didn’t remember ever learning how to make random lines or dots in class.

Right, we didn’t talk about it in class. Can you answer the following questions: (1) What makes a dot random? (2) What makes a line random?

I haven’t been using ++i or i++ in for (i = 0; i < 10; i = i + 1) because I am not sure I understand them.

It doesn’t matter which of i = i + 1, i++, and ++i is employed, because they all produce the same outcome in i. The value returned by the expression not used anywhere. The case would be different, for instance, in the following code.

     i = 0 
     x = (i = i + 1)        // i = 1,  x = 1 
     x = ++i                // i = 1,  x = 1 
     x = i++                // i = 1,  x = 0 
I have provided the bodies for 6 methods, so for the rest, I am free to attempt each drawing, or create my own?

Yes.