diff --git a/T5Q2-B-FromSol1/src/ClassF.java b/T5Q2-B-FromSol1/src/ClassF.java index cd9a8dc..80e2ce3 100644 --- a/T5Q2-B-FromSol1/src/ClassF.java +++ b/T5Q2-B-FromSol1/src/ClassF.java @@ -2,4 +2,4 @@ public class ClassF extends ClassE { public void print(int x) { System.out.println(x); } -} +} \ No newline at end of file diff --git a/T5Q3/src/Polygon.java b/T5Q3/src/Polygon.java index 34bd4d2..2201a75 100644 --- a/T5Q3/src/Polygon.java +++ b/T5Q3/src/Polygon.java @@ -1,5 +1,5 @@ -public abstract class Polygon { -//public class Polygon { +//public abstract class Polygon { +public class Polygon { public enum KindofPolygon { POLY_PLAIN, POLY_RECT, @@ -29,14 +29,45 @@ public abstract class Polygon { return name; } -// public float calArea() { -// return 0; -// } + public float calArea() { + return 0; + } public void printWidthHeight( ) { System.out.println("Width = " + width + " Height = " + height); } - public abstract float calArea(); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// public abstract float calArea(); } \ No newline at end of file diff --git a/T5Q3/src/TestPolygon.java b/T5Q3/src/TestPolygon.java index 2f34292..ab056ff 100644 --- a/T5Q3/src/TestPolygon.java +++ b/T5Q3/src/TestPolygon.java @@ -38,6 +38,25 @@ public class TestPolygon { + + + + + + + + + + + + + + + + + + + public static void printArea(Polygon poly) { @@ -48,11 +67,11 @@ public class TestPolygon { public static void main2(String[] args ) { Rectangle rect = new Rectangle("Rectangle", 3.0f, 4.0f); - printArea(rect); + printArea(rect); // dynamic binding rect.printWidthHeight(); Triangle triangle= new Triangle("Triangle", 3.0f, 4.0f); - printArea(triangle); + printArea(triangle); // dynamic binding triangle.printWidthHeight(); } } \ No newline at end of file