Let's use the variable x to represent the time on the train and y to represent the time on the bus.
If the total time is 4 hours, we have:
[tex]x+y=4[/tex]If the total distance is 135 miles, we have:
[tex]40x+30y=135[/tex]From the first equation, we have y = 4 - x.
Using this value in the second equation, we have:
[tex]\begin{gathered} 40x+30(4-x)=135 \\ 40x+120-30x=135 \\ 10x=15 \\ x=1.5 \\ \\ y=4-1.5 \\ y=2.5 \end{gathered}[/tex]Therefore Manuel was on the train for 1.5 hours.