Added direct code of homework7-part2