Solution of the Programming Assignment 2