Momentum = mass * velocity
Cart 1:
mass = 4.0 kg
velocity = 5.0 m/s
momentum = 20
Cart 2:
mass = 3.0 kg
velocity = -4.0 m/s (opposite direction)
momenum = -12
Cart 1 and 2:
mass = 7.0 kg
velocity = ??
20 - 12 = 7v
8 = 7v
v = 8/7
v = 1 1/7 m/s
So your answer should be: 1 1/7 m/s in the direction of the heavier