Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Variables [8/14]

This program chooses a random point. Then it draws 22 circles around it with a random radius of up to 190.
[Run the program]

Exercises:

1. Move the first statement of the program inside the for loop. Make it a first statement of the loop.
[Run the program]

2. Add a println statement just above the sleepMs statement that prints out the coordinate x.

Solution

println x;

[Run the program]

3. Modify the println statement such that prints out both the coordinates x and y, separated by a space.

Solution

println x, " ", y;

[Run the program]

4. Modify the println statement so that it prints out the coordinates in the form (x, y) - for example, like: (321, 456).

Solution

println "(", x, ", ", y, ")";

[Run the program]

5. Make the program draw 50 circles instead of 22.

Loading...