Hello!
You can make two equations based on what you know
let x stand for andy's age
let y stand for Jeff's age
x = 2 + y
5 + x + 5 + y = 40
Put x into the second equation
5 + (2 + y) + 5 + y = 40
Combine like terms
12 + 2y = 40
Subtract 12 from both sides
2y = 28
Divide both sides by 2
y = 14
Put y into the first equation
x = 2 + (14)
x = 16
Andy is 16 and Jeff is 14
Hope this helps!