answer hw2.2d
finalize hw 2