📄 circle4.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package cylinder;/** * * @author Rossiter */public class Circle4 extends Point3 { private double radius; // Circle4's radius // no-argument constructor public Circle4() { // implicit call to Point3 constructor occurs here } // constructor public Circle4( int xValue, int yValue, double radiusValue ) { super( xValue, yValue ); // call Point3 constructor explicitly setRadius( radiusValue ); } // set radius public void setRadius( double radiusValue ) { radius = ( radiusValue < 0.0 ? 0.0 : radiusValue ); } // return radius public double getRadius() { return radius; } // calculate and return diameter public double getDiameter() { return 2 * getRadius(); } // calculate and return circumference public double getCircumference() { return Math.PI * getDiameter(); } // calculate and return area public double getArea() { return Math.PI * getRadius() * getRadius(); } // return String representation of Circle4 object public String toString() { return "Center = " + super.toString() + "; Radius = " + getRadius(); }} // end class Circle4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -