Question: Based on the following class: public class Circle { / / The radius of this circle, and the x & y coordinates of the circle

Based on the following class:
public class Circle {
// The radius of this circle, and the x & y coordinates of the circle center
private double radius, centerX, centerY;
//Construct a circle object
public Circle(double radius, double centerX, double centerY){
this.radius = radius;
this.centerX = centerX;
this.centerY = centerY;
}
//Construct a circle object
public Circle(){
this (1.0,1.0,1.0);
}
// get and set methods for the private data fields radius, centerX, centerY
// an instance distance method
}
Complete the Circle class by adding three sets of get and set methods for the three private data
fields. In the Circle class, add another instance method that is passed a reference variable for a
circle object and returns the distance between the circle that is passed to the method and the
current circle. Your distance method should have the following signature line:
public double distance(Circle c)
The distance formula between any two points (x1,y1) and (x2,y2) is given by:
= #(21)*+(21)*

Step by Step Solution

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 Databases Questions!