Solution for Programming Assignment2