Question: Answer the questions A-D about the following declaration of class Circle: *A. Declare and create a variable of type Circle called innerCircle. B. Write a

Answer the questions A-D about the following declaration of class Circle:

class Circle { } private double radius; public Circle() { radius= 0.0;

*A. Declare and create a variable of type Circle called innerCircle.
B. Write a statement using the setRadius method to change the value of innerCircle's data member, radius to 10.0 .
*C. Write a statement using the getRadius method to output the value of innerCircle's data member, radius, preceded by the phrase "The value of radius is ".
D. Write a statement using the compute Circumference method to output the value of inner Circle's circumference, preceded by the phrase "The value of the circumference is ".

class Circle { } private double radius; public Circle() { radius= 0.0; } public double getRadius () { return radius; } public void setRadius (double inputRadius) { radius= inputRadius; } public double computeCircumference () { return 2*Math.PI*radius; } public double computeArea () { return Math.PI* Math.pow (radius, 2); }

Step by Step Solution

3.49 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction Java Program Questions!