Circle Shape
Geoffrey Challen // 2020.6.0
Create and complete the implementation of the Circle class.
Your class should inherit from the Shape class,
and provide the following methods:
- Constructor that takes a
Doubleparameter. Creates a newCirclewith the passed radius. You can assume that the passed radius is greater than zero. You should call theShapeconstructor and pass it theString"circle" to identify the type of this shape. - Implement the
Shapemethodareathat takes no arguments and returns adouble. Return the area of this shape:Math.PI * radius * radius. - Override
fun equals(other: Any?): Boolean. Returntrueifotheris aCirclewith the same radius, andfalseotherwise. Note thatothermay benullor not aCircle.
Finally, note that your class should not expose any of its internal state publicly.