Morningstar interview question

Review code and spot errors