This is the code for Assignment 1.