Hanna, let's call the speed of the westboubd train w. Then the speed of the eastbound train is w + 12, right?
Distance = speed x time
340 = 2w + 2(w + 12)
340 = 2w + 2w + 24
4w = 316
w = 79
Soooo, the eastbound train was going 91 mph.
Hope this helps!