Created
June 24, 2017 15:23
-
-
Save khunzohn/cfa54b3d469d3d99f253d2e85e5281bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DigitMapper { | |
public DigitMapper() { | |
} | |
public String mapToWord(int digit) throws DigitRangeException { | |
if (digit < 0 || digit > 9) throw new DigitRangeException(); | |
switch (digit) { | |
case 0: | |
return "Zero"; | |
case 1: | |
return "One"; | |
// case 2,3,...9 | |
default: | |
return ""; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment