If he traveled x mi by bus, then the time taken using bus is x/40 hours
and therefore, she took (580-x) mi by train, thus the time taken with train was (580-x)/80 hours.
Hence, x/40 +(580-x)/80 = 9.5 hours
80(x/40) +80 (580-x)/80 = (9.5)80
= 2x + 580-x = 760
x= 760-580
x = 180
Thus the train covered a distance of (580-x) =580-180 = 400
Hence, Wendy took 400/80 = 5 hours on the train