finish chap1-4 exercise