add calculations for hw 9.