大家一起来找查,谢拉
abstract class Shape{
protected abstract prostion(float x,float y);
public abstract move(float x,float y);
public abstract show();
}
class Point
{
private float x;
private float y;
Point(float x,float y)
{
this.x=x;
this.y=y;
}
public void setX()
{
this.x=x;
}
public void setY()
{
this.y=y;
}
public float getX()
{
return x;
}
public float getY()
{
return y;
}
public String toString()
{
return x+","+y;
}
}
public class Line extends Shape
{
private Point start;
private Point end;
Line(Point start,Point end)
{
this.start=start;
this.end=end;
}
protected String prostion(Point x,Point y)
{}
public int show()
{}
public String toString()
{
return "起点"+start+"终点"+end;
}
public float getLang()
{
return Math.sqrt(Math.(end.getX()-start.getX(),2)+Math.(end.getY()-start.getY(),2));
}
public String toString()
{
return "起点"+start.toString()+"终点"+end.toString()+"直线长"+getLang();
}
public void move(float x,float y)
{
start.setX(start.getX()+x);
end.set(end.getX()+x);
start.setY(start.getY()+y);
end.set(end.getY()+y);
}
}
class Circle extends Shape
{
private Point center;
private float r;
protected String prostion(Point x,Point y)
{}
public int show()
{}
Circle(Point center,float r)
{
this.center=center;
this.r=r;
}
public void setCenter(Point center)
{
this.center=center;
}
public void setR(float r)
{
this.r=r;
}
public Point getCenter()
{
return center;
}
public float getR()
{
return r;
}
public void move(float x,float y)
{
center.getX()+x;
center.getY()+y;
}
public String toString()
{
return "圆心坐标"+center+"半径"+r;
}
}
public class P263E1
{
public static void main(String args[])
{
Line line=new Line(new Point(6,3),new Point(8,9));
System.out.println(line.toString());
Circle circle=new Circle(new Point(6,8),8);
System.out.println(circle.toString());
}
}
//一个很简单的问题,帮忙改下错误
//能标出来指教最好
//谢谢拉