The program in project 1 was changed in order to compute color by accumulating the the tristimulus curves in XYZ color model. I used the following matrix which is available on this page, to obtain the RGB values.
r = 2.95176 *x + -1.28951 *y + -0.47388 *z;
g = -1.0851*x + 1.99084 *y + 0.0372023 *z;
b = 0.0854804 *x + -0.269456 *y + 1.09113 *z;
Later I used color gamma correction factor of 1.8 which works better on a mac.