Let's say John's age is x and Jack's age is y
(1) x + 5 = y
(2) y + 2 = 2(x + 2)
Now if we substitute equation (1) into equation (2) we get:
x + 5 + 2 = 2(x + 2)
x + 7 = 2x + 4
x = 3
If x = 3, then from equation (1) we get:
3 + 5 = y
y = 8
Therefor John is 3 years old and Jack is 8 years old