Monday, July 27, 2009

Simple Java help?

public class Triangle extends AbstractShape {


protected double sideA;


protected double sideB;


protected double sideC;


public Triangle() {


sideA = sideB = sideC = 0;


}


public Triangle(double a, double b, double c) {


sideA = a;


sideB = b;


sideC = c;


}


public String name() {


return "Triangle";


}


public double area() {


double s = (sideA + sideB + sideC) / 2.0;


return Math.sqrt( s*(s-sideA)*(s-sideB)*(s-sideC) );


}


public double perimeter() {


return sideA + sideB + sideC;


}


}





this code is compiling but giving me a NoSuchMethodError. Please help? thanks

Simple Java help?
Does not look easy, may be you can contact a java expert live at website like http://homeworkhelp.co.in/ .
Reply:1) AbstractShape isn't in your listing. Do you have it?





2) Where's your Main()?


No comments:

Post a Comment