⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cylinder.java

📁 Cylinder Project, Java Application
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package cylinder;/** * * @author Rossiter */public class Cylinder extends Circle4 {   private double height;  // Cylinder's height   // no-argument constructor   public Cylinder()   {      // implicit call to Circle4 constructor occurs here   }   // constructor   public Cylinder( int xValue, int yValue, double radiusValue,      double heightValue )   {      super( xValue, yValue, radiusValue ); // call Circle4 constructor      setHeight( heightValue );   }   // set Cylinder's height   public void setHeight( double heightValue )   {      height = ( heightValue < 0.0 ? 0.0 : heightValue );   }   // get Cylinder's height   public double getHeight()   {      return height;   }   // override Circle4 method getArea to calculate Cylinder area   public double getArea()   {      return 2 * super.getArea() + getCircumference() * getHeight();   }   // calculate Cylinder volume   public double getVolume()   {      return super.getArea() * getHeight();   }   // return String representation of Cylinder object   public String toString()   {      return super.toString() + "; Height = " + getHeight();   }} // end class Cylinder

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -