求java高手帮我改一下下面程序:

来源:百度知道 编辑:UC知道 时间:2024/05/10 05:33:22
public abstract class Shape extends Object {

public double area()
{
return 0.0;
}
public double volume()
{
return 0.0;
}
public abstract Sting getName();
}

//definition of class Point
public class Point extends Shape{
protected int x,y;

public Point()
{
setPoint(0,0);
}

public Point(int xcoordinate,int ycoordinate)
{
setPoint(xcoordinate,ycoordinate);
}
public void Point(int xcoordinate,int ycoordinate)
{
x=xcoordinate;
y=ycoordinate;
}

public int getX()
{
return x;
}
public int getY()
{
return y;
}
public String toString()
{
return "["+x+","+y+"]";

第一个错误:
public abstract Sting getName();
拼写错误:String;
第二个:
没找到setPoint();加个此方法;
第三个:
protected double weight,height;
public Rectangle()
{
setRectangle(0.0,0.0);
}

public Rectangle(int xcoordinate,int ycoordinate,double weight,double height)
{
super(xcoordinate,ycoordinate );
setRectangle(w,h);
}
前面声明的变量是weight,height,下面却用w,h,改下;
第四个:
return "Center="+super.tostring()+"; weight="+weight+";height="+height;
toString()中S要大写。
第五个:
return "center="+Point.super.toString()+";Radius="+Radius;
变量Radius的r应该是小写的。

这代码郁闷呀兄弟。以后写程序认真点。