三角形を作成して宿題の表面を計算するこの小さなプログラムを実行し、Eclipseでテストしましたが、システムにアップロードしようとすると、すべて同じタイプの6つのエラーが発生します。
/test/src/math.test/TestTriangleFunctionPublic.java:4:エラー:シンボルのインポートが見つかりませんmath.NotATriangleException; ^シンボル:クラスNotATriangleException
/test/src/math.test/TestTriangleFunctionPublic.java:5:エラー:シンボルのインポートmath.Triangleが見つかりません。^シンボル:クラス三角形の場所:パッケージ計算
/test/src/math.test/TestTriangleFunctionPublic.java:45:エラー:シンボルactual = Triangle.calculateArea(a、b、c);が見つかりません。^シンボル:可変三角形の場所:クラスTestTriangleFunctionPublic
/test/src/math.test/TestTriangleFunctionPublic.java:46:エラー:シンボルが見つかりません} catch(NotATriangleException e1){^シンボル:クラスNotATriangleException場所:クラスTestTriangleFunctionPublic
/test/src/math.test/TestTriangleFunctionPublic.java:56:エラー:シンボルactual = Triangle.calculateArea(a、b、c);が見つかりません。^シンボル:可変三角形の場所:クラスTestTriangleFunctionPublic
/test/src/math.test/TestTriangleFunctionPublic.java:57:エラー:シンボルが見つかりません} catch(NotATriangleException e){^シンボル:クラスNotATriangleException場所:クラスTestTriangleFunctionPublic
これは2つのクラスです:
package math;
public class Triangle {
static double s;
double surface = 0;
static double a;
static double b;
static double c;
public double calculateArea(double a, double b, double c) throws NotATriangleException{
if (a<= 0.0 || b <= 0.0 || c <= 0.0){
throw new NotATriangleException("Cannot construct Triangle!");
}
else if( (a+b)<=c && (a+c)<=b && (b+c)<=a){
throw new NotATriangleException("Cannot construct Triangle!");
}
else {
s = ((a + b + c)/2);
surface = Math.sqrt(s * (s - a) * (s - b) * (s - c));
return surface;
}
}
public double getErgebnis (){
return surface;
}
}
およびExceptionクラス:
package math;
@SuppressWarnings("serial")
public class NotATriangleException extends Exception {
public NotATriangleException(String message) {
super(message);
}
public NotATriangleException(String message,Throwable throwable) {
super(message, throwable);
}
}
何が悪いのかわからないのでがっかりです!