Code for assignment 1 in CS559