Solved solution programming assignment 2