?? cylinder.java
字號:
package counttest;
public class Cylinder extends Circle {
private double length;
/** Construct a cylinder with default properties */
public Cylinder() {
this(1.0, 1.0);
}
/** Construct a cylinder with specified radius, and length */
public Cylinder(double radius, double length) {
this(radius, length, "white", false );
}
/** Construct a cylinder with specified radius, filled, color, and
length
*/
public Cylinder(double radius, double length,
String color, boolean filled ) {
super(radius, color, filled);
this.length = length;
}
/** Return length */
public double getLength() {
return length;
}
/** Set a new length */
public void setLength(double length) {
this.length = length;
}
/** Return the surface area of this cylinder */
public double findArea() {
return 2 * super.findArea() + 2 * getRadius() * Math.PI * length;
}
/** Return the volume of this cylinder */
public double findVolume() {
return super.findArea() * length;
}
/** Override the toString method defined in the Object class */
public String toString() {
return "[Cylinder] radius = " + getRadius() + " and length "
+ length;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -