Answer
The speed of the moving train is 2.35 m/s
Work Step by Step
The beat frequency is the difference between the two frequencies. We can find the frequency $f'$ which is received from the approaching train.
$f'-f = 3.5~Hz$
$f' = f+3.5~Hz$
$f' = 508~Hz+3.5~Hz$
$f' = 511.5~Hz$
We then find the speed of the moving train:
$f' = \frac{f}{(1-\frac{v_{train}}{v_{snd}})}$
$1-\frac{v_{train}}{v_{snd}} = \frac{f}{f'}$
$v_{train} = (1-\frac{f}{f'})(v_{snd})$
$v_{train} = (1-\frac{508~Hz}{511.5~Hz})(343~m/s)$
$v_{train} = 2.35~m/s$
The speed of the moving train is 2.35 m/s.