1  public abstract class GeometricObject {
  2    private String color = "white";
  3    private boolean filled;
  4    private java.util.Date dateCreated;
  5  
  6    /** Construct a default geometric object */
  7    protected GeometricObject() {
  8      dateCreated = new java.util.Date();
  9    }
 10  
 11    /** Construct a geometric object with color and filled value */
 12    protected GeometricObject(String color, boolean filled) {
 13      dateCreated = new java.util.Date();
 14      this.color = color;
 15      this.filled = filled;
 16    }
 17  
 18    /** Return color */
 19    public String getColor() {
 20      return color;
 21    }
 22  
 23    /** Set a new color */
 24    public void setColor(String color) {
 25      this.color = color;
 26    }
 27  
 28    /** Return filled. Since filled is boolean,
 29     *  the get method is named isFilled */
 30    public boolean isFilled() {
 31      return filled;
 32    }
 33  
 34    /** Set a new filled */
 35    public void setFilled(boolean filled) {
 36      this.filled = filled;
 37    }
 38  
 39    /** Get dateCreated */
 40    public java.util.Date getDateCreated() {
 41      return dateCreated;
 42    }
 43  
 44    @Override
 45    public String toString() {
 46      return "created on " + dateCreated + "\ncolor: " + color +
 47        " and filled: " + filled;
 48    }
 49  
 50    /** Abstract method getArea */
 51    public abstract double getArea();
 52  
 53    /** Abstract method getPerimeter */
 54    public abstract double getPerimeter();
 55  }