programming assignment for Algorithm II