Question: iii. Write a public instance method moveBy() whose first argument is an int representing the distance to move and whose second argument is a char
iii. Write a public instance method moveBy() whose first argument is an int representing the distance to move and whose second argument is a char representing the direction in which to move. It should return no value. Cable 1: Directions and corresponding x and y ncrements direction xInc Inc right 'R' 1 left 'L' up 'U down D' Begin by declaring local int variables xInc and yInc and use the table above to set these for the appropriate increments depending on the supplied argument for direction. The method should then move the StickFigure the required distance and direction 1 step at a time, using a loop
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
