part1 #2-4 of hw4