📄 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 + -