Added code for exercise 3 hw3