Code for programming assignment two