Square Shape
Geoffrey Challen // 2020.6.0
Create and complete the implementation of the Square class.
Your class should be public, not final and not abstract, inherit from the Shape class,
and provide the following methods:
- Constructor that takes a
Doubleparameter. Creates a newSquarewith the passed side length. You can assume that the passed size is greater than zero. You should call theShapeconstructor and pass it theString"square" to identify the type of this shape. - Implement the
Shapemethodareathat takes no arguments and returns aDouble. Return the area of this shape:side * side. - Override
public boolean equals(Object other). Returntrueifotheris aSquarewith the same width and height, andfalseotherwise. Note thatothermay benullor not aSquare.
Finally, note that your class should not expose any of its internal state publicly.