请教!!!!!!!!!!
//*假定每个形状又一个(X,Y)原点*/ Point类
public class Point
{ Private double myX;
Private double myY;
public Point(double x,double y)
{myX=x;myY=y;}
public Point()
{ my=0;myY=0;}
public double getX()
{return myX;}
public double getY()
{return myY}
public void setPoint(double x,double y)
{myX=x;myY=y;}
}
/*RGB颜色表示方法*/
Public class Color
{ Private int blue;
Private int green;
Private int red;
public Color(int r,int g,int b)
{red=r;green=g;red=b;}
public int getB()
{ return blue;}
public int getG()
{return green;}
public int getR()
{return red;}
public void setRGB(int r,int g,int b)
{red=r;green=g;blue=b;}
}
/*各种形状的抽象类*/
public abstract class Shape
private Color color;
private Point origin;
protected Shape(Color col,Point org)
{ origin=new Point(org.getX(),org.getY());
color=new Color(col.getR(),col.getG(),col.getB());
}
protected Shape(Point org)
{ Origin=new Point(org.getX(),org.getY());
Color=new Color(0,0,0);
}
protected Shape()
{ Origin=new Point(0.0,0.0);/原点为(0,0)/
Color=new Color(0,0,0);
}
public abstract double area();
public abstract double perimeter();
public Color getColor()
{ return color;}
public void setColor(Color col)
{ color.setRGB(col.getR(),col.getG(),col.getB());}
pubilc Point getOrigin()
{ return origin;}
public void setOrigin(Point org)
{ origin.setPoint( org.getX(),org.getY(());
}
1. public int getB()
{ return blue;}这中方法对于调用他的类来说有什么用处;
2.Shape类中三个构造方法是实现什么功能的(第三个应该是初始话吧);
3.public Color getColor()
{ return color;}
返回的是不是Color类型的三个颜色值啊?
搜索更多相关主题的帖子:
double public Private myY Point
----------------解决方案--------------------------------------------------------