Question: Problem 2. Modify written in class Robot class (see code on Moodle) to add meth- ods void east) and void west(). These methods should move

 Problem 2. Modify written in class Robot class (see code on
Moodle) to add meth- ods void east) and void west(). These methods

Problem 2. Modify written in class Robot class (see code on Moodle) to add meth- ods void east) and void west(). These methods should move the position of a robot by one unit to the right and to the left, respectively. Test your code the same way as I tested methods void north) and void south. That is, call these methods from Test class and printing out the old and the new coordinates of the robot. 1 class Robot 2 int x=100; 3 int y=100; 4 void north() { 5 y = y + 1; 6 } 7 void south(int n){ y = y - n; 9 } 10 void south() { 11 y = y - 1; 12 } 13}

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!