Create and complete the implementation of the
Your class should be public, inherit from the
Shape class, and provide the following methods:
- Constructor that takes a
doubleparameter. Creates a new
Pentagonwith the passed side length. If the passed length is less than or equal to 0, throw an
IllegalArgumentException. You should call the
Shapeconstructor and pass it the
String"pentagon" to identify the type of this shape.
- Public instance method
areathat takes no arguments and returns a
double. Return the area of this shape, given only the side length, which you can find here: https://www.cuemath.com/measurement/area-of-pentagon/. You will need to use
Math.sqrtto solve this problem.
public boolean equals(Object other). Return
Pentagonwith the same side length, and
falseotherwise. Note that
nullor not a
Finally, note that your class should not expose any of its internal state publicly.