/**
 * A runner is a thread incrementing an integer variable ITERATION times
 * and printing some messages.
 *
 * @version     1.1    January 25, 2000
 * @author      Franck van Breugel
 */
public class Runner extends Thread 
{
    /**
     * Constructs a thread with the specied name.
     * @param name Name of the thread.
     */
    public Runner(String name) 
    {
        super(name);
    }

    /** The number of times the variable is incremented. */
    private static final int INCREMENT = 40000000;

    /** 
     * Increments the variable INCREMENT times and prints some
     * messages.
     */
    public void run() 
    {
        System.out.println(getName() + " starts");
        int tick = 1;
        while (tick < INCREMENT) 
        {
            tick++;
            if ((tick % (INCREMENT / 10)) == 0 && tick < INCREMENT) 
            {
                System.out.println(getName() + " has run " + ((int) (100 * ((double) tick / INCREMENT)))  + " meters");
            }
        }
        System.out.println(getName() + " finishes");
    }
}


