aboutsummaryrefslogtreecommitdiffstats
path: root/csci1913/Java/lab6/lab6_strap012.java
diff options
context:
space:
mode:
Diffstat (limited to 'csci1913/Java/lab6/lab6_strap012.java')
-rw-r--r--csci1913/Java/lab6/lab6_strap012.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/csci1913/Java/lab6/lab6_strap012.java b/csci1913/Java/lab6/lab6_strap012.java
new file mode 100644
index 0000000..e2c96e4
--- /dev/null
+++ b/csci1913/Java/lab6/lab6_strap012.java
@@ -0,0 +1,19 @@
+package lab6;
+
+class Rectangle extends Polygon {
+ public Rectangle(int l, int w) {
+ super(4, l, w, l, w);
+ }
+ public int area() {
+ return this.side(0)*this.side(1);
+ }
+}
+
+class Square extends Polygon {
+ public Square(int l) {
+ super(4, l, l, l, l);
+ }
+ public int area() {
+ return this.side(0)*this.side(1);
+ }
+} \ No newline at end of file