Code for Assignment 6