updating program 3 of assignment 2