added task 2 of homework 4 with tests