Advanced Programming chapter2 code