Add exercise 3 in assignment 2