finish problem9 ~ problem12 in project 2.