class Point//定义一个点 内包含点的属性 设置 返回 等
{
double x;
double y;
Point(double _x,double _y)
{
x = _x;
y = _y;
}
public void setx(double _x){ x = _x; }
public void sety(double _y){ y = _y;}
public double getx(){return x;}
public double gety(){return y;}
}
class Circle//定义一个圆 包含原点 半径等
{
Point o ;
double r;
Circle(Point x,double _r)
{
o = x;
r = _r;
}
Circle(double _r)
{
o = new Point(0.0,0.0);
r = _r;
}
public void seto(double _x,double_y)
{
o.setx(_x);
o.sety(_y);
}
public Point geto(){return o;};
public void setr(double _r){r = _r;};
public double getr(){return r;};
public double area()
{
return 3.14*r*r;
}
}
public class TestCircle
{
public static void main(String[] args)
{
Circle c1 = new Circle(new Point(1.0,2.0),2.0);
Circle c2 = new Circle(2.0);
System.out.println("c1.x="+c1.geto().getx()+" c1.y="+c1.geto().gety()+"c1.r="+c1.getr()+"");
}
}
{
double x;
double y;
Point(double _x,double _y)
{
x = _x;
y = _y;
}
public void setx(double _x){ x = _x; }
public void sety(double _y){ y = _y;}
public double getx(){return x;}
public double gety(){return y;}
}
class Circle//定义一个圆 包含原点 半径等
{
Point o ;
double r;
Circle(Point x,double _r)
{
o = x;
r = _r;
}
Circle(double _r)
{
o = new Point(0.0,0.0);
r = _r;
}
public void seto(double _x,double_y)
{
o.setx(_x);
o.sety(_y);
}
public Point geto(){return o;};
public void setr(double _r){r = _r;};
public double getr(){return r;};
public double area()
{
return 3.14*r*r;
}
}
public class TestCircle
{
public static void main(String[] args)
{
Circle c1 = new Circle(new Point(1.0,2.0),2.0);
Circle c2 = new Circle(2.0);
System.out.println("c1.x="+c1.geto().getx()+" c1.y="+c1.geto().gety()+"c1.r="+c1.getr()+"");
}
}