Ask Question
12 March, 00:07

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.

+3
Answers (1)
  1. 12 March, 00:14
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers