Question: Define a class named Circle. A Circle object stores a radius and the (x, y) coordinates of its center point. Each Circle object should have

Define a class named Circle. A Circle object stores a radius and the (x, y) coordinates of its center point. Each Circle object should have the following public methods:

Circle(center, radius) Constructs a new circle with a center specified by the given Point and with the given integer radius.

getCenter() Returns the circle's center Point.

getRadius() Returns the circle's radius.

getArea() Returns the area occupied by the circle, using the formula r2.

getCircumference() Returns the circle's circumference (distance around the circle), using the formula 2r.

toString() Returns a string representation of the circle, such as "Circle[center=(75, 20),radius=30]".

draw(g) Draws the circle onto a DrawingPanel, labeling its center point and drawing an outline of the circle itself.

contains(p) Returns whether the given point lies inside the 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!