What three modifications are necessary to ensure that the class is being properly encapsulated?

Given: This class is poorly encapsulated. You need to change the circle class to compute
and return the area instead. What three modifications are necessary to ensure that the class
is being properly encapsulated?

Given: This class is poorly encapsulated. You need to change the circle class to compute
and return the area instead. What three modifications are necessary to ensure that the class
is being properly encapsulated?

A.
Change the access modifier of the setradius () method to private

B.
Change the getArea () method public double getArea () { return area; }

C.
When the radius is set in the Circle constructor and the setRadius () method, recomputed
the area and store it into the area field

D.
Change the getRadius () method: public double getRadius () { area = Math.PI * radius *
radius; return radius; }



Leave a Reply 2

Your email address will not be published. Required fields are marked *