The CircleCalculator
class problem
Fill in the bodies of the methods in the following class. Then write a class TestCircleCalculator with a static main method that creates
a CircleCalculator and exercises each of the methods.
Extensions:
Add setDiameter, getDiameter, and getRadius methods. Do not add a myDiameter instance variable.
Complete the class with setArea and setCircumference methods.
/**
* Calculates values for a
circle, given the radius. The
radius can be changed
* through the setRadius() method.
*
* @author Tim Corica
* @version July 2004
*/
public class CircleCalculator
{
// Instance variables.
private double myRadius = 20;
private final
double PI = 3.14159;
/**
* Sets the value of the radius to be
used in subsequent calculations.
*/
public void setRadius(double radius)
{
}
/**
* Returns the area of a circle using the
current radius value.
*/
public double getArea()
{
}
/**
* Returns the circumference of a circle
using the current radius value.
*/
public double getCircumference()
{
}
}