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

📄 geometricobject.java

📁 学生综测系统 不会吧 大哥 下个东西这么烦啊
💻 JAVA
字号:
// GeometricObject.java: The abstract GeometricObject class
public abstract class GeometricObject
{
  protected String color;
  protected double weight;

  // Default construct
  protected GeometricObject()
  {
    color = "white";
    weight = 1.0;
  }

  // Construct a geometric object
  protected GeometricObject(String color, double weight)
  {
    this.color = color;
    this.weight = weight;
  }

  // Getter method for color
  public String getColor()
  {
    return color;
  }

  // Setter method for color
  public void setColor(String color)
  {
    this.color = color;
  }

  // Getter method for weight
  public double getWeight()
  {
    return weight;
  }

  // Setter method for weight
  public void setWeight(double weight)
  {
    this.weight = weight;
  }

  // Abstract method
  public abstract double findArea();

  // Abstract method
  public abstract double findPerimeter();
}

⌨️ 快捷键说明

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