Assignment 3 from the Stanford Java programming course CS106A