My solution to the programming assignment 2