Ask Question
23 June, 04:41

Create a class Circle with one instance variable of type double called radius. Then define an appropriate constructor that takes an initial value for the radius, get and set methods for the radius, and methods getArea and getPerimeter.

+1
Answers (1)
  1. 23 June, 04:57
    0
    public class Circle {

    / / the private data members

    private double radius;

    private double area;

    private double diameter;

    public void setRadius (double r)

    {

    radius = r;

    }

    public double getRadius ()

    {

    return radius;

    }

    public double computeDiameter ()

    {

    return radius * 2;

    }

    public double computeArea ()

    {

    return ((radius * radius) * 3.14);

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Create a class Circle with one instance variable of type double called radius. Then define an appropriate constructor that takes an initial ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers