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 polygon
    boolean equals​(java.lang.Object obj)  
    java.util.ArrayList<java.lang.Integer> getSides()
    Get sides of Polygon
    int hashCode()  
    java.lang.String toString()  

    Methods inherited from class Shape

    calculateArea, draw

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • 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 class Shape
    • calculatePerimeter

      public double calculatePerimeter()
      Calculate perimeter of polygon
      Specified by:
      calculatePerimeter in class Shape
      Returns:
      perimeter of Shape
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class Shape
    • equals

      public boolean equals​(java.lang.Object obj)
      Specified by:
      equals in class Shape