You can put this solution on YOUR website! Call their ages NOW, j and p. Then we have
j = p + 4
In two years,
j+2 + p+2 = 50
Now substitute the first into the second and get
p+4+2 + p+2 = 50
2p + 8 = 50
2p = 42
p = 21
and j = p + 4 = 25
James is 25 now.