finished ex 1, assignment 7