title: Changing the direction of a point
body: <p>I was to create a code where I mimic the functions of a robot. Turning and moving and such. I feel as if I'm approaching this in all the wrong ways... When I was writing this I thought I understood the gist of it, if the direction in the constructor is this then if it turn the new direction is this. I tested this and of course I ended up with some real incorrect results. I'm absolutely sure that I don't actually use any of these functions for my object. Can I get a tip about how to work this kind of code? </p>
  
  <pre><code>import java.awt.Point;
  public class Robot
  {
  private int x;
  private int y;
  private int d;
  private int p;
  public static final int NORTH = 0;
  public static final int SOUTH = 1;
  public static final int EAST = 2;
  public static final int WEST = 3;
  
  /**
   * Constructor for objects of class Robot
   * @param theX the x coordinate
   * @param theY the y coordinate
   * @param theDirection the direction the robot is facing
   */
  public Robot(int theX, int theY, int theDirection)
  {
      x = theX;
      y = theY;
      d = theDirection;
  }
  
  public void turnLeft()
  {
      if(d == NORTH) {
          d = WEST;
      }
      if(d == WEST) {
          d = SOUTH;
      }
      if(d == SOUTH) {
          d = EAST;
      }
      if(d == EAST) {
          d = NORTH;
      }
  }
  
  
  
  public String getDirection()
  {
      if(d == NORTH) {
          return "N";
      }
      if(d == SOUTH) {
          return "S";
      }
      if(d == WEST) {
          return "W";
      }
      if(d == EAST) {
          return "E";
      }   
      return "";
  }
  }
  </code></pre>
  
  <p>Testing</p>
  
  <pre><code>Robot rob = new Robot(20, 20, Robot.SOUTH);
  rob.turnLeft;
  System.out.println(rob.getDirection);
  </code></pre>
  
  <p>this return S when I think it should actually return E.</p>