finish exercise 3.17 ~ 3.18 in section 3.3.1