my solution to Assignment #2