CS-321 Lab 5: Polygons

This is a 1-week lab.

Overview

It is now time to add more complicated shapes to our program. Specifically, we will be adding polygons because they have the interesting feature that their size (i.e., number of vertices) is variable.

There are other shapes besides polygons, however, that have a variable number of vertexes, and it wouldn't be good to reinvent the wheel (e.g., file reading and writing code) for each one. Therefore, a `varshape' abstract base class (ABC) has been written to encapsulate common elements of polygons, polylines, Bézier curves, etc. varshape is derived from shape so that it shares the common interface (has a color and type, has concrete classes that implement Clone and Draw, etc.)

[UML Static Structure Diagram: shape, point, line, varshape, Polygon]

You will derive your polygon class from varshape. You will need to implement constructors, the destructor, and operator=. You should only need to override Draw and Clone. You may modify the varshape class if needed (for example, if you are using something besides a char for type), but make sure that it remains viable as a base class for other shapes that are defined by a variable number of vertexes.

Activities

Without removing any prior functionality from your shell, do the following. Some of these items may have already been completed for previous labs.

Additional Details

There are many areas for extra credit with this assignment, however you must complete the basic requirements in order to receive extra credit. Some possibilities include...

Consult with your professor in advance of adding extra-credit elements to your program.

Demonstration (during week 7 lab)

You will need to demonstrate your project to the instructor during the week 7 lab meeting. The demonstration will count for 25% of your project grade.

Lab report (due 4 P.M., the day before the week 7 lab)

Your lab report need not be self-contained. This means that it is not necessary to restate the entire specification in your report.

If you have any questions, consult the instructor.

Course Objectives Addressed