programming assignment 3, adding solution to first problem