CSC1109_Tutorials/Week5_Lab/GeometricObject/RectangleFromSimpleGeometri...

45 lines
1.0 KiB
Java

package Week5_Lab.GeometricObject;
public class RectangleFromSimpleGeometricObject extends GeometricObject{
private double width;
private double height;
public RectangleFromSimpleGeometricObject(){
super();
}
public RectangleFromSimpleGeometricObject(double width, double height){
super();
this.width = width;
this.height = height;
}
public RectangleFromSimpleGeometricObject(double width, double height, String color, boolean filled){
super(color, filled);
this.width = width;
this.height = height;
}
public double getWidth() {
return this.width;
}
public void setWidth(double width) {
this.width = width;
}
public double getHeight(){
return this.height;
}
public double setHeight(){
return this.height;
}
public double getArea(){
return this.width * this.height;
}
public double getPerimeter(){
return 2 * (this.width + this.height);
}
}