Ask Question
7 November, 23:37

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. 7 November, 23:52
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers