diff --git a/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java new file mode 100644 index 000000000..268fff341 --- /dev/null +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -0,0 +1,14 @@ +package core.basesyntax; + +public class Bulldozer extends Machine { + + @Override + public String goWork() { + return "Bulldozer started its work!"; + } + + @Override + public String stopWork() { + return "Bulldozer stopped its 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..cb1f82928 --- /dev/null +++ b/src/main/java/core/basesyntax/Excavator.java @@ -0,0 +1,14 @@ +package core.basesyntax; + +public class Excavator extends Machine { + + @Override + public String goWork() { + return "Excavator started its work!"; + } + + @Override + public String stopWork() { + return "Excavator stopped its 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..56377620c --- /dev/null +++ b/src/main/java/core/basesyntax/Machine.java @@ -0,0 +1,8 @@ +package core.basesyntax; + +public abstract class Machine { + + public abstract String goWork(); + + public abstract String stopWork(); +} diff --git a/src/main/java/core/basesyntax/MainApp.java b/src/main/java/core/basesyntax/MainApp.java index f99e9a019..b620fe20d 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -1,5 +1,17 @@ package core.basesyntax; public class MainApp { + public static void main(String[] args) { + Machine truck = new Truck(); + Machine bulldozer = new Bulldozer(); + Machine excavator = new Excavator(); + + String[] matrixMachine = {truck.goWork(),bulldozer.goWork(),excavator.goWork(), + truck.stopWork(), bulldozer.stopWork(), excavator.stopWork()}; + + for (String matrix : matrixMachine) { + System.out.println(matrix); + } + } } diff --git a/src/main/java/core/basesyntax/Truck.java b/src/main/java/core/basesyntax/Truck.java new file mode 100644 index 000000000..29f293cc0 --- /dev/null +++ b/src/main/java/core/basesyntax/Truck.java @@ -0,0 +1,14 @@ +package core.basesyntax; + +public class Truck extends Machine { + + @Override + public String goWork() { + return "Truck started its work!"; + } + + @Override + public String stopWork() { + return "Truck stopped its work!"; + } +}