We are looking for John and Jim's age
lets assign variables
I choose to use m for Jim's age, n for John's age, and d for David's age.
Now that we have variables we can write three equations
Because the sum of the ages is 35 we get (i) m + n + d = 35
John is 3 years older than Jim gives us (ii) n = m + 3
Jim is 4 years less than David, so m = d - 4 or (iii) d = m + 4
We have three equations in three unknowns, we want to get one equation in one unknown so we can solve it.
we can substitute into equation (i) the values of d and n expressed in terms of m
m + (m + 3) + (m + 4) = 35
now combine like terms and solve for Jim;s age (m)
once you find Jims age use equations (ii) and (iii) to find the other boys ages.