my answer to prog assignment2