Different values need to be stored in the object's x
and y
variables.
Here is the Circle
class with two new methods.
The setPosition()
method will be used to
change the location of a circle.
The setRadius()
method will be used to change the radius of a circle.
Such methods are called access methods
because they access the data of an object.
Well-designed classes allow access to their
data only through access methods.
To enforce this,
the variables of a class are often made private
.
Complete the methods by filling in the blanks.