```
package circle;
public class CircleClass
{
// member variables
private double radius, circumference, area;
// constructor function
public CircleClass() { }
public CircleClass(double r) { setRadius(r); }
// accessors
public double getRadius() { return radius; }
public double getCircumference() { return circumference; }
public double getArea() { return area; }
// data modifiers
public void setRadius(double x)
{
radius = x;
circumference = 2 * Math.PI * radius;
area = Math.PI * radius * radius;
}
public void setCircumference(double x)
{
circumference = x;
radius = circumference / (2 * Math.PI);
area = Math.PI * radius * radius;
}
private void setArea(double x)
{
area = x;
radius = Math.sqrt(area / Math.PI);
circumference = 2 * Math.PI * radius;
}
}
```

About the Author

1

Contributor0

Replies1

Views**Are you able to help answer this sponsored question?**

Questions asked by members who have earned a lot of community kudos are featured in order to give back and encourage quality replies.

Recommended Topics