method validateUserInput() implemented to throw exception for invalid command