Question: Write the code in java. E8.26 Implement a class Robot that simulates a robot wandering on an infinite plane. The robot is located at a

 Write the code in java. E8.26 Implement a class Robot that

Write the code in java. E8.26 Implement a class Robot that simulates a robot wandering on an infinite plane. The robot is located at a point with integer xy-coordinates and faces north, east, south, or west. Code the following methods and a default constructor. public void turnLeft() public void move() public Point getLocation() public String getDirection0) public String toString) 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 get Direction method returns a string "N", "E", "S", or "W". The default constructor must set the instance variables for the location to x-0 y-0 and direction to "N". The toString method returns the current location and direction X Y D. Test the class by creating a Robot, have it travel around a 2x2 square, calling toString at each corner, including the initial corner

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!