Just add up the 3 legs of the triangle representing J's walk.
From (2,9) to (7,9) is 5 miles; from (7,9) to (2,2) is sqrt(25+49) miles (using the Pythagorean Theorem); and from (2,2) to (2,9) is 7 miles.
Add these 3 lengths together to obtain your final answer.