Code for assignment #2

This is the code for assignment #2