surface.java

来自「Java the UML Way 书中所有源码」· Java 代码 · 共 35 行

JAVA
35
字号
/*
 * Surface.java   E.L. 2001-05-17
 */
class Surface {
  private String name;  // for identification purposes
  private double length;
  private double width;
  
  public Surface(String initName, double initLength, double initWidth) {
    name = initName;
    length = initLength;
    width = initWidth;
  }

  public String getName() {
    return name;
  }

  public double getLength() {
    return length;
  }

  public double getWidth() {
    return width;
  }

  public double getArea() {
    return width * length;
  }

  public double getCircumference() {
    return 2 * (length + width);
  }
}

⌨️ 快捷键说明

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