diff --git a/lab-01/src/_Rectangle.java b/lab-01/src/_Rectangle.java new file mode 100644 index 0000000..7fd4aa4 --- /dev/null +++ b/lab-01/src/_Rectangle.java @@ -0,0 +1,34 @@ +public class _Rectangle extends _Point { + + private double height; + private double width; + + public _Rectangle(double width, double height){ + this.height = height; + this.width = width; + this.setLocation(0, 0); + } + + public _Rectangle(int x, int y, double w, double h){ + this.width = w; + this.height = h; + this.setLocation(x, y); + } + + public void setHeight(double h){ this.height = h; } + + public void setWidth(double w){ this.width = w; } + + public double getHeight(){ return this.height; } + + public double getWidth(){ return this.width; } + + public double getArea(){ return this.height*this.width; } + + public double getCircumfrence(){ return 2*(this.width+this.height); } + + public String toString() { + return String.format("%s, Height %f, Width %f, Area %f, Circumfrence %f", + super.toString(), getHeight(), getWidth(), getArea(), getCircumfrence()); + } +}