An answer is given below.
The loop is a counting loop. Each iteration of the loop will draw one red circle when the loop body is filled in:
import java.applet.Applet;
import java.awt.*;
// assume that the drawing area is 300 by 150
public class tenCircles extends Applet
{
final int width = 300, height = 150;
public void paint ( Graphics gr )
{
int count = 0;
while ( count < 10 )
{
count = count + 1;
}
}
}
There are many ways to fill in the blanks so the loop iterates 10 times, but usually it is best to have a counter that goes from 1 to 10, or from 0 to 9. Often arithmetic is easier when the loop counts from 0 to 9.
Now let us focus on drawing the circles. The idea is to draw 10 circles in a row, nicely spaced out across the screen.