Pre-Lab
Pre-Lab

For this pre-lab, use SimpleClosed2DPolygon.java without modifying in any way.

SimpleClosed2DPolygon is a SUPER CLASS we will use for today's lab working with closed, two-dimensional polygons.

SimpleClosed2DPolygon.java

Here's a simple client for it.

Client.java

Pre-Lab
DON'T MAKE THIS HARD   (This means you!)

The pre-lab can be done by adding SEVEN LINES to the begin method of the client provided. Read instructions carefully, take a look at the provided source code and get to work.

Download and compile the 2D polygon code into your directory and write another client for it which FULLY exercises all it's methods including all constructors by creating, drawing, and printing vertices of all three polygons specified below

  1. black triangle near the upper left corner of the canvas

  2. red rectangle near the upper right corner of the canvas

  3. green pentagon in the general middle of the canvas

Hint: You will probably also find it useful to "redirect" standard input to come from a file of your choice rather than typing in all the vertex coordinates time after time after ....


       java PolyClient < inputFile.txt