My solution: (algebra method)
1. let a be the umbrella, b be the cog and c be the pumpkin.
2. 3a = 18, so a = 6
3. a + 2c = 40, so 2c = 40 - 6 = 34, so c = 17
4. a + b + c = 37, so b + c = 37 - 6 = 31, b = 31 - 17 = 14
so, the umbrella = 6, the cog = 14 and the pumpkin = 17