Code for Assignment 7