finish exercise 3.7~3.8 in section 3.1.3