Complex sentence: When Mary, Spratt and the inspector enter Humpty's house, they wonder how Humpty got his money: he had no proper job and all he did was invest in failing companies.
Split into simpler sentences: When Mary, Spratt and the inspector enter Humpty's house, the question they have in mind is how did Humpty get his money? He had no proper job and all he did was invest in failing companies.