From 4bfbc29c7ea0b711f96346deb25dde0b2298ecde Mon Sep 17 00:00:00 2001 From: Julian T Date: Tue, 15 Sep 2020 18:51:31 +0200 Subject: Added more oop assignments --- sem5/oop/m4/shapes/src/Main.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 sem5/oop/m4/shapes/src/Main.java (limited to 'sem5/oop/m4/shapes/src/Main.java') diff --git a/sem5/oop/m4/shapes/src/Main.java b/sem5/oop/m4/shapes/src/Main.java new file mode 100644 index 0000000..3c06699 --- /dev/null +++ b/sem5/oop/m4/shapes/src/Main.java @@ -0,0 +1,23 @@ +import java.util.ArrayList; + +public class Main { + + public static void main(String[] args) { + System.out.println("Doing the stuff."); + + ArrayList shp = new ArrayList<>(); + + shp.add(new MyCircle(new MyPoint(3, 4), 10)); + shp.add(new MyTriangle( + new MyPoint(0, 0), + new MyPoint(4, 5), + new MyPoint(23, 4))); + shp.add(new MyRectangle(new MyPoint(0, 3), new MyPoint(-10, 10))); + + + for (Shape2d s : shp) { + System.out.printf("area: %f, p: %f%n", s.area(), s.perimeter()); + } + } + +} -- cgit v1.2.3