Answer
An almost identical problem is done on page 101.
Let m represent the mass of the freight car, 4m the mass of the diesel engine, and v the velocity after both are coupled together.
Calculate the total momentum before the collision.
$$(4m)(5 km/h) + 0$$
Now calculate the momentum after the collision, when the combined masses move together at velocity v.
$$(4 m + m)v$$
By the conservation of momentum principle, the two expressions are equal.
The mass m cancels out, and we solve for $$v = 4 km/h$$