assignment 6, part 1, source code