I get error Main method not found in class robot.Robot, please define the main method as: public static void main(String[] args). Can someone help me fix this error? Heres what I am trying to do:
Implement a class Robot that simulates a robot wandering randomly on an infinite plane. The robot is located at a point with integer coordinates and faces north, east, south, or west. Supply Methods:
public void turnLeft() public void turnRight() public void move() public Point getLocation() public String getDirection()
The turnLeft and turnRight methods change the direction but not the location. The move method moves the robot by one unit in the direction it is facing. The getDirection method returns a string "N", "E'', "S", or "W".
package robot; import java.awt.Point; import java.util.Random; public class Robot { // TODO: define other instance variables private int posX; private int posY; private final int orgX; private final int orgY; private final Random generator; /** * Constructor for objects of class Robot * * @param theX the x coordinate * @param theY the y coordinate */ public Robot(int theX, int theY) { // TODO: Complete the constructor posX = theX; posY = theY; orgX = theX; orgY = theY; generator = new Random(); generator.setSeed(12345); //do not change this statement } // TODO Supply getLocation public Point getLocation() { //return null; return new Point(posX, posY); } // TODO: Supply the methods of the Robot class public double getDistanceFromStart() { return Math.sqrt(Math.pow(posX - orgX, 2) + Math.pow(posY - orgY, 2)); } public void makeRandomMove() { int move = generator.nextInt(4); if (move == 0) { posY++; } else if (move == 1) { posY--; } else if (move == 2) { posX++; } else { posX--; } } }