solved exercises 7 to 13 in chapter3