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.
那這個問題又出在哪呢?菜鳥級別,請大家指教
總結
以上是生活随笔為你收集整理的java find symbol,cannot find symbol的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 常用Cocoa框架概览
- 下一篇: TypeError: empty() r