work on exercise 7
added solution for exercise 7