You are viewing a single comment's thread. Return to all comments →
**Java Code : // Complete the catAndMouse function below.
static String catAndMouse(int x, int y, int z) { int catADistance = Math.abs(x-z); int catBDistance = Math.abs(z-y); return (catADistance == catBDistance)?"Mouse C":(catADistance>catBDistance)? "Cat B": "Cat A" ; }
Seems like cookies are disabled on this browser, please enable them to open this website
Cats and a Mouse
You are viewing a single comment's thread. Return to all comments →
**Java Code : // Complete the catAndMouse function below.
static String catAndMouse(int x, int y, int z) { int catADistance = Math.abs(x-z); int catBDistance = Math.abs(z-y); return (catADistance == catBDistance)?"Mouse C":(catADistance>catBDistance)? "Cat B": "Cat A" ; }