天天看点

java find symbol,cannot find symbol

class triangle {

double a;

double b;

double c;

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

if((a+b>c)&&(a+c>b)&&(b+c>a)&&(a-c

this.a=a;

this.b=b;

this.c=c;

}

else {

System.out.println("输入边长有错");

}

}

public double GetCircle(){

return (a+b+c);

}

public double GetArea(){

double p;

p=(a+b+c)/2.0;

return (Math.sqrt(p*(p-a)*(p-b)*(p-c)));

}

}

class Tprism extends triangle{

double height;

public Tprism (double a ,double b,double c,double height){

super(a,b,c);

if((a+b>c)&&(a+c>b)&&(b+c>a)&&(a-c

this.a=a;

this.b=b;

this.c=c;

this.height=height;

}

else {

System.out.println("输入边长有错");

}

}

public double volume(){

return (super.GetArea()*height);

}

}

class pramid extends rectangle{

double height;

public pramid(double a, double b, double c,double height){

super(a,b,c);

if((a+b>c)&&(a+c>b)&&(b+c>a)&&(a-c

this.a=a;

this.b=b;

this.c=c;

this.height=height;

}

else {

System.out.println("输入边长有错");

}

}

public  double volume(){

return (super.GetArea()*height*(1/3));

}

}

class exp1{

public static void main(String [] args){

triangle r = new triangle(3.0,4.0,5.0);

Tprism c=new Tprism(3.0,4.0,5.0,6.0);

pramid d=new pramid(3.0,4.0,5.0,6.0);

System.out.println("三角形的周长" + r.GetCircle());

System.out.println("三角形的面积"+r.GetArea());

System.out.println("三棱柱的底面积"+c.GetCircle());

System.out.println("三棱柱的底周长"+c.GetArea());

System.out.println("三棱柱的体积"+c.volume());

System.out.println("三棱锥的底面积"+d.GetArea());

System.out.println("三棱锥的体积"+d.volume());

}

}

--------------------Configuration: hh - JDK version 1.5.0_02 --------------------

G:\java\hh\exp1.java:50: cannot find symbol

symbol: class rectangle

class pramid extends rectangle{

^

G:\java\hh\exp1.java:57: cannot find symbol

symbol  : variable a

location: class pramid

this.a=a;

^

G:\java\hh\exp1.java:58: cannot find symbol

symbol  : variable b

location: class pramid

this.b=b;

^

G:\java\hh\exp1.java:59: cannot find symbol

symbol  : variable c

location: class pramid

this.c=c;

^

G:\java\hh\exp1.java:68: cannot find symbol

symbol  : variable super

location: class pramid

return (super.GetArea()*height*(1/3));

^

G:\java\hh\exp1.java:85: cannot find symbol

symbol  : method GetArea()

location: class pramid

System.out.println("三棱锥的底面积"+d.GetArea());

^

6 errors

Process completed.

那这个问题又出在哪呢?菜鸟级别,请大家指教