partial homework4 code