小弟有问题请大哥帮忙
下面是我刚写的程序请问错误是是: abstract class GeometricObject{ protected String color;
protected double weight;
protected GeometricObject()
{ color ="white";
weight=1.0;
}
protected GeometricObject(String color,double weight)
{this.color=color;
this.weight=weight;
}
public String getColor()
{return color;
}
public void setColor(String color)
{this.color=color;
}
public double getWeight()
{return weight;
}
public void setWeight(double weight)
{this.weight=weight;
}
public abstract double findArea();
public abstract double findPerimeter();
}
class Triangle extends GemometricObject
{ private double side1,side2,side3;
Triangle(double side1,double side2,double side3)
{side1=3.0;
side2=4.0;
side3=5.0;
}
public double findArea()
{double s=(side1+side2+side3)/2;
double area=Math.sqrt(s*(s-side1)*(s-side2)*(s-side3));
return area;
}
public double findPerimeter()
{double s=(side1+side2+side3)/2;
return s;
}
}
public class Example
{public static void main(String[] args)
{Triangle t=new Triangle();
double b=t.findArea();
System.out.println("the triangle''s s is:"+t.findPerimeter()+"now the triangle''s area is:"+t.findArea());
}
}
请各位大哥帮帮忙哈