Question: Q: Opposite direction If statements may be useful Implement the function public String oppositeDirection(String direction) in the manner described by the comments. The code: package

Q: Opposite direction If statements may be useful
Implement the function public String oppositeDirection(String direction) in the manner described by the comments.
The code:
package oppositedirection;
public class OppositeDirection {
/** * Determines and returns the opposite direction. * Returns "up" if direction is "down", "down" if direction is "up", * "right" if direction is "left", "left" if direction is "right", "none" if * direction is anything else. * Return value is case sensitive. * * @param direction The direction to be evaluated. * @return String containing the opposite direction from the provided direction. */ public String oppositeDirection(String direction) { // write your code here }
}
1 package oppositedirection; 2 3 public class OppositeDirection { 4 Opposite direction /** * Determines and returns the opposite direction. * Returns "up" if direction is "down", "down" if direction * "right" if direction is "left", "left" if direction is * direction is anything else. * Return value is case sensitive. If statements may be useful Implement the function 6 7 8 9 10 11 12 13 14 15 16 17 18 19 } 20 public String oppositeDirection(String direction) * @param direction The direction to be evaluated. * @return String containing the opposite direction from th */ public String oppositeDirection(String direction) { // write your code here } in the manner described by the comments
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
