An engineer is piloting a runaway trolley which he can only steer from one narrow track on to another; five men are working on one track and one man on the other; anyone on the track he enters is bound to be killed. Since he cannot stop the trolley, he must either choose to steer to the track with five men on it or the track with one.
In another scenario, a judge is faced with a mob which demands that the perpetrator a certain crime be found and executed. If their demands aren't met within twenty-four hours, they threaten to execute five hostages. The real culprit being unknown, the judge has an opportunity to prevent the murder of the five by framing an innocent person and having him executed.
What is the correct course of action in each scenario and why?