Add the solution for Programming Assignment2