complete source code for homework 5