Stanford Programming Methodology Assignment 4