completed ex. 3 of assignment 2