Solution to the Programming Assignment number 2.
test.R: script to test the proposed solution