finish 2nd problem of hw3