Answer:
a) The distance travelled by the the locomotive is 30 meters, b) The final displacement of the locomotive is 6 meters westwards.
Step-by-step explanation:
a) The distance travelled is the sum of magnitudes of distances covered by the train during its motion. That is to say:


The distance travelled by the the locomotive is 30 meters.
b) The displacement is the vectorial distance of the train with respect to a point of reference, since west and east are antiparallel to each other, calculations can be simplified to a scalar form. Let suppose that movement to the east is positive. The calculations are presented below:

The final displacement of the locomotive is 6 meters westwards.