solution to the programming assignment