Solution for the programming assignment