title: Random Walking Program
body: <p>I'm to write a program that does the following </p>
  
  <p>'We will assume that the random walk takes place on a square grid with the point (0,0) at the center. The boundary of the square will be a single integer that represents the maximum x and y coordinate for the current position on the square (so for a boundary value of 10, both the x and y coordinates can vary from -10 to 10, inclusive). Each step will be one unit up, one unit down, one unit to the left, or one unit to the right. (No diagonal movement.)'</p>
  
  <p>The RandomWalk class will have the following instance data (all type int):
  •   the x coordinate of the current position
  •   the y coordinate of the current position
  •   the maximum number of steps in the walk
  •   the number of steps taken so far in the walk
  •   the boundary of the square (a positive integer -- the x and y coordinates of the position can vary between plus and minus this value)</p>
  
  <ol>
  <li>First declare the instance data (as described above) and add the following two constructors and toString method.</li>
  </ol>
  
  <p>a)RandomWalk (int max, int edge) - Initializes the RandomWalk object. The maximum number of steps and the boundary are given by the parameters. The x and y coordinates and the number of steps taken should be set to 0.</p>
  
  <p>b)RandomWalk (int max, int edge, int startX, int startY) -- Initializes the maximum number of steps, the boundary, and the starting position to those given by the parameters.</p>
  
  <p>c)String toString() - returns a String containing the number of steps taken so far and the current position -- The string should look something like: Steps: 12; Position: (-3,5)</p>
  
  <p>So for part 1 this is what I came up with
      public class RandomWalk  {</p>
  
  <pre><code>int max;
  int edge;
  int startX;
  int startY;
  
  public RandomWalk (int max, int edge)
  {
      this.max = max;
      this.edge = edge;
  
  }
  
  public void RandomWalk (int max, int edge, int startX, int startY)
  {
      this.max = max;
      this.edge = edge;
      this.startX = startX;
      this.startY = startY;
  }
  
  public String toString()
  {
      return "Max amount of steps.:" + this.max + ",," + "Edge.:" + this.edge +
              ",," + "Starting position on X.:" + this.startX + ",," + "Starting position of Y.:" + this.startY;
  }
  </code></pre>
  
  <p>But apparently this is the test class</p>
  
  <pre><code>public static void main (String[] args)
  {
  
      int maxSteps; // maximum number of steps in a walk
      int maxCoord; // the maximum x and y coordinate
      int x, y; // starting x and y coordinates for a walk
      Scanner scan = new Scanner(System.in);
      System.out.println ("\nRandom Walk Test Program");
      System.out.println ();
      System.out.print ("Enter the boundary for the square: ");
      maxCoord = scan.nextInt();
      System.out.print ("Enter the maximum number of steps: ");
      maxSteps = scan.nextInt();
      System.out.print ("Enter the starting x and y coordinates with " +
              "a space between: ");
      x = scan.nextInt();
      y = scan.nextInt();     
  }
  }
  </code></pre>
  
  <p>I'm not sure what the test program is supposed to be storing, I'd just like clarification on my code.</p>
  
  <p>Ar there any examples one can think of that can help me go in the right direction?</p>