Density functional calculations of molecular polarizabilities and hyperpolarizabilities