Trying to use a for loop to make a table, getting a "cannot find symbol error"
<p>I have an assignment to make a program which will take user input of speed and hours to find distance. I have a class with a method to make the calculation but need to use a for loop to output a table which will show hours traveled for every hour the user puts in, like this:</p>

<h2>hours           distance traveled</h2>

<p>1                              10
2                              20 
3                              30
etc.</p>

<p>First I wrote the class to make the calculation but when I put together the for loop i got an error for the counter.</p>

<p>Here is the class for the object with a method to calculate the distance.</p>

<pre><code>package distancetraveled;

public class DistanceTraveled {

private double speed;       //speed
private int hours;      //hours
private double distance;    //distance

//distanceTravelled constructor
public DistanceTraveled(double s, int h) {
    speed = s;
    hours = h;
}

// findDistance method
public double findDistance() {
    distance = speed * hours;
    return distance;
}

// setSpeed method
public void setSpeed(double s) {
    s = speed;
}

// set distance method
public void setDistance(int h) {
    h = hours;
}

// getSpeed method
public double getSpeed() {
    return speed;
}

//getDistance method
public double getDistance() {
    return distance;
}
</code></pre>

<p>}</p>

<p>And the program to display the table:</p>

<pre><code>package distancetraveled;

import java.util.Scanner;

public class DistanceTraveledTest {

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

    double testSpeed;
    int testHours;

    System.out.println("What is the speed of the vehicle?");
    testSpeed = input.nextDouble();
    while (testSpeed &lt;= 1){
        System.out.print("The speed must be equal to or greater than one");
        System.out.println("What is the speed of the vehicle?");
        testSpeed = input.nextDouble();
    }

    System.out.println("How many hours has the vehicle been travelling?");
    testHours = input.nextInt();

    while (testHours &lt;= 1){
        System.out.print("The hours must be equal to or greater than one");
        System.out.println("How many hours has the vehicle been traveling?");
        testHours = input.nextInt();
    }


    DistanceTraveled traveller = new DistanceTraveled(testSpeed, testHours);

    System.out.println("Hour\t\tDistance Travelled");
    System.out.println("------------------------------");

    for(i=0;i&lt;=testHours;i++){
           System.out.print(testHours + "\t\t" + traveller.findDistance());



    }

}
}
</code></pre>

<p>I'm sure there are plenty of other errors as well. Thank you everyone and anyone.</p>
