Advanced Programming Homework 8 Solution