Complete coding for Project2-Task4