solved exercise 6 from objects