Class Polygon
java.lang.Object
Shape
Polygon
public abstract class Polygon
extends Shape
-
Constructor Summary
Constructors Constructor Description Polygon(java.lang.Integer... sides)
Create a new Polygon shape -
Method Summary
Modifier and Type Method Description double
calculatePerimeter()
Calculate perimeter of polygonboolean
equals(java.lang.Object obj)
java.util.ArrayList<java.lang.Integer>
getSides()
Get sides of Polygonint
hashCode()
java.lang.String
toString()
-
Constructor Details
-
Polygon
public Polygon(java.lang.Integer... sides)Create a new Polygon shape- Parameters:
sides
- sides of polygon
-
-
Method Details
-
getSides
public java.util.ArrayList<java.lang.Integer> getSides()Get sides of Polygon- Returns:
- returns sides of polygon
-
toString
public java.lang.String toString()- Overrides:
toString
in classShape
-
calculatePerimeter
public double calculatePerimeter()Calculate perimeter of polygon- Specified by:
calculatePerimeter
in classShape
- Returns:
- perimeter of Shape
-
hashCode
public int hashCode()- Specified by:
hashCode
in classShape
-
equals
public boolean equals(java.lang.Object obj)- Specified by:
equals
in classShape
-