part1-part5 of hw4