Refactor.
Rewrite printSegment() to handle any number of points.