Exercise from Peter Cooper's "Beginning Ruby"