I am making an object is able to read and follow instructions. My code compiles, but my object doesn't act how it should. Any insight would be appreciated! This is in my actor class.
public void act()
{
if (input.hasNext() == true)
{
if (new String(input.next()).equals("left"))
{
this.left();
}
else if (new String(input.next()).equals("right"))
{
this.right();
}
else if (new String(input.next()).equals("forward"))
{
this.forward();
}
}
}
public void forward()
{
move(1);
}
public void left()
{
turn(-90);
}
public void right()
{
turn(90);
}
