#Way too complicated#
Way too complicated
Everything after the two isLetter()
checks is extremely complicated and unnecessary. You can just subtract the two character values, like this:
public int getDistanceBetweenTwoLetters(char firstChar, char secondChar) throws AlphabetException {
if(!isLetter(firstChar)){
throw new AlphabetException(firstChar+" is not part of the alphabet");
}
if(!isLetter(secondChar)){
throw new AlphabetException(secondChar+" is not part of the alphabet");
}
return Character.toLowerCase(secondChar) - Character.toLowerCase(firstChar);
}