working solution to AST630 hw2 problems