diff --git a/src/main/java/core/basesyntax/Buildozer.java b/src/main/java/core/basesyntax/Buildozer.java new file mode 100644 index 000000000..fdb10f1cb --- /dev/null +++ b/src/main/java/core/basesyntax/Buildozer.java @@ -0,0 +1,13 @@ +package core.basesyntax; + +public class Buildozer extends Machine{ + @Override + public void doWork() { + System.out.println("Buildozer started work."); + } + + @Override + public void stopWork() { + System.out.println("Buildozer stoped work."); + } +} diff --git a/src/main/java/core/basesyntax/Excavator.java b/src/main/java/core/basesyntax/Excavator.java new file mode 100644 index 000000000..c80c0ee5b --- /dev/null +++ b/src/main/java/core/basesyntax/Excavator.java @@ -0,0 +1,13 @@ +package core.basesyntax; + +public class Excavator extends Machine{ + @Override + public void doWork() { + System.out.println("Excavator started work."); + } + + @Override + public void stopWork() { + System.out.println("Excavator stopped work."); + } +} diff --git a/src/main/java/core/basesyntax/Machine.java b/src/main/java/core/basesyntax/Machine.java new file mode 100644 index 000000000..5a62715c2 --- /dev/null +++ b/src/main/java/core/basesyntax/Machine.java @@ -0,0 +1,6 @@ +package core.basesyntax; + +public abstract class Machine { + public abstract void doWork(); + public abstract void stopWork(); +} diff --git a/src/main/java/core/basesyntax/MainApp.java b/src/main/java/core/basesyntax/MainApp.java index f99e9a019..695c9a104 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -1,5 +1,11 @@ package core.basesyntax; public class MainApp { - + public static void main(String[] args) { + Machine[] machines = new Machine[]{new Truck(), new Buildozer(), new Excavator()}; + for (Machine machine : machines) { + machine.doWork(); + machine.stopWork(); + } + } } diff --git a/src/main/java/core/basesyntax/Truck.java b/src/main/java/core/basesyntax/Truck.java new file mode 100644 index 000000000..8995ce93e --- /dev/null +++ b/src/main/java/core/basesyntax/Truck.java @@ -0,0 +1,13 @@ +package core.basesyntax; + +public class Truck extends Machine{ + @Override + public void doWork() { + System.out.println("Truck started work."); + } + + @Override + public void stopWork() { + System.out.println("Truck stopped work."); + } +}