Question 909376
Let x be The age of Sam TODAY
Let y denote the age of John TODAY

Five years ago, Sam was four times as old as John
This simply translates that 4 years ago from their CURRENT age, Sam's age back then was 4 times john's age which translates in algebra to:
(x - 4) = 4(y - 4)
simplifying:
x - 4 = 4y - 16
x - 4y = -12 (*)

Now for the next part,
and in five years he (refers to sam) will be twice as old as John

This is again the same concept, after 5 years, Sam's age will now equal to 2 times the age of john's which in algebra translates to:

(x + 5) = 2(y + 5)
x + 5 = 2y + 10
x - 2y = 5 ($)

Now we have two equations, (*) and ($) Which are:
x - 4y = -12 (*)
x - 2y = 5 ($)

If we subtract (*) from ($) we get:

-2y = -17
y = 17/2
y = 8.5 years old
Therefore John's current age is 8.5 years (Technically he is still 8 years old)
Solving for x we get:

x - 4y = -17
x - 4(8.5) = -17
x - 34 = -17
x = 17
Terefore Sam's current age is 17

Hope it helped,
El Farouk