Fourth section done

Completed and debugged code for fourth section of the asassignment.