Added code for exercise 4 hw3
Added code for exercise 7 hw3