?? cylinder.java
字號:
import p3.circle;
import p2.Point;
public class Cylinder extends p3.circle
{
int height;
Cylinder(){}
Cylinder(Point p,int r,int h)
{
super(p,r);
height=h;
}
Cylinder(int x,int y,int r,int h)
{
super(x,y,r);
height=h;
}
int getHeight()
{
return height;
}
double volume()
{ return height*super.area();
//return Math.PI*r*r*height;
}
double surfaceArea()
{
return (2*Math.PI*r*r+2*Math.PI*r*height);
}
public boolean equals(Cylinder c)
{
return center.equals(c.center)&&c.r==r&&c.getHeight()==height;
}
public String toString()
{
return super.toString()+"the heigth is "+height;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -