The answer to your question would be that the sentence that shows the correct use of hyphens is the following one: He teaches twenty-two seven-year-olds. That is, the correct option would be D.
When writing a compound number, we use a hyphen between each word. This applies to any number between 21 and 99. That is why twenty-two is hyphenated. Then, seven-year-olds is functioning as a noun.