A Computational Method for Determining the Optical Constants of Thin Films