Question: Create and complete the implementation of the Circle class. Your class should be public, not final and not abstract, inherit from the Shape class, and

Create and complete the implementation of the Circle class. Your class should be public, not final and not abstract, inherit from the Shape class, and provide the following methods:

  1. Constructor that takes a double parameter. Creates a new Circle with the passed radius. You can assume that the passed radius is greater than zero. You should call the Shape constructor and pass it the String "circle" to identify the type of this shape.
  2. Public instance method area that takes no arguments and returns a double. Return the area of this shape: Math.PI * radius * radius.
  3. Override public boolean equals(Object other). Return true if other is a Circle with the same radius, and false otherwise. Note that other may be null or not a Circle.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!