In: Computer Science
[20 marks] (TestRobot.java) Design a class named Robot. The Robot class has three private data fields: position x, position y, and the direction (east, south, west, and north). Assume that positive x points to the east and positive y points to the south, and initially x = 0, y = 0, direction = "east".
Create a no-arg constructor and another constructor which sets the three data fields. Create the accessors and mutators for the three data fields.
Create a method named forward that moves the robot along the current direction for the given distance. For example, if the robot is currently facing east, forward(10) will move the robot along the positive x direction for 10 pixels.
In the main method, create a Robot object, move it to the east for 20 pixels, then set the direction to north and move 30 pixels, and finally set the direction to west and move 40 pixels. Find and display the final x and y values and the direction of robot by calling its methods. For example, for the sample testing above, your program should display x = -20, y = -30, and direction = west.
JAVA program screenshots for the provided problem statement
JAVA program Output screenshots