import java.util.*;
public class Circle {
//Attributes
Point center;
double radius;
public Circle(){
center = new Point();
radius = 1;
}
public Circle(double x, double y, double r){
center = new Point(x,y);
radius = r;
}
public Circle(Point p, double r){
radius = r;
center = p;
}
public Circle(LineSegment diameter){
center = diameter.midpoint();
radius = diameter.length()/2;
}
public String getEquation(){
String s = "(x -" + center.getX() + ")^2";
s = s + " + (y -" + center.getY() + ")^2";
s = s + " = " + radius* radius;
return s;
}
}
Post a Comment
Hi. :-h