Polygon_Project

Polygon_Project - Polygon Project A complete project should...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Polygon Project A complete project should include the following features. 1. Polygon.java a. Create a utility file named Polygon.java that constructs polygons as linked lists of Points using the class Point.java that has been provided previously. We will always assume that the last point connects to the first point without representing this in the class. The number of vertices only counts the first and last point once however. The polygon ABC has three vertices. Include a default constructor, a second constructor which given an array of points creates the obvious polygon. Add a third constructor which given one polygon and a point D appends D at the end of the polygon. For example, given the polygon ABC and the point D, the constructor returns the polygon ABCD. Add a fourth constructor which given two polygons constructs their direct sum. For example ABC + DEFG = ABCDEFG. b. Add a method print() which prints out all the points of a polygon. Add a method numberOfVertices() which gives the number of vertices in the polygon. Add a method perimeter() which adds up the length of all the sides of the polygon. Add an accessor method getPoint(int n)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

Polygon_Project - Polygon Project A complete project should...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online