FileDocCategorySizeDatePackage
Radii.javaAPI DocExample1060Wed Aug 02 12:03:36 BST 2000None

Radii

public class Radii extends Applet

Fields Summary
private int
counter
private int
stopValue
private final int
x1Coord
private final int
y1Coord
private final int
x2Coord
Constructors Summary
Methods Summary
public voidpaint(java.awt.Graphics g)

	// declare and initialise x2Coord constant
	
	   
	
		stopValue = (int)(Math.random() * 20 + 1); // generate a random termination value
		counter = 1;						// initialise the loop control variable
		while (counter <= stopValue)			// loop stopValue times
		{
			g.drawLine(x1Coord, y1Coord, x2Coord, counter * 10);
			counter = counter + 1;		// increment the loop control variable
		}
		g.drawString(stopValue + " Nice lines", 20, counter * 10 + 20);