Assignment2 source code.