From c650c170acd1c47a2d675a0d41725c3644f22689 Mon Sep 17 00:00:00 2001 From: Mykyta Oleksin <32339836+nacenik@users.noreply.github.com> Date: Fri, 12 May 2023 10:15:08 +0300 Subject: [PATCH 1/3] Update ci.yml to java 17 --- .github/workflows/ci.yml | 4 ++-- src/main/java/core/basesyntax/Bulldozer.java | 12 ++++++++++++ src/main/java/core/basesyntax/Excavator.java | 14 ++++++++++++++ src/main/java/core/basesyntax/Machine.java | 8 ++++++++ src/main/java/core/basesyntax/MainApp.java | 11 ++++++++++- src/main/java/core/basesyntax/Truck.java | 12 ++++++++++++ 6 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 src/main/java/core/basesyntax/Bulldozer.java create mode 100644 src/main/java/core/basesyntax/Excavator.java create mode 100644 src/main/java/core/basesyntax/Machine.java create mode 100644 src/main/java/core/basesyntax/Truck.java diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ead0ef36a..282f50ac5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,10 +8,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v2 with: - java-version: '11' + java-version: '17' distribution: 'adopt' cache: maven - name: Build with Maven diff --git a/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java new file mode 100644 index 000000000..fc1f6158f --- /dev/null +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -0,0 +1,12 @@ +package core.basesyntax; + +public class Bulldozer extends Machine { + @Override + public void doWork() { + System.out.println("Machine started its work"); + } + @Override + public void stopWork() { + System.out.println("Machine 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..8c46df714 --- /dev/null +++ b/src/main/java/core/basesyntax/Excavator.java @@ -0,0 +1,14 @@ +package core.basesyntax; + +public class Excavator extends Machine { + @Override + public void doWork() { + System.out.println("Machine started its work"); + } + + @Override + public void stopWork() { + System.out.println("Machine 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..7e60ee127 --- /dev/null +++ b/src/main/java/core/basesyntax/Machine.java @@ -0,0 +1,8 @@ +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..bbf3f2d44 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -1,5 +1,14 @@ package core.basesyntax; public class MainApp { - + public static void main(String[] args) { + Machine track = new Truck(); + Machine excavator = new Excavator(); + Machine bulldozer = new Bulldozer(); + Machine [] machines = new Machine [] {track,bulldozer,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..8d02a3a35 --- /dev/null +++ b/src/main/java/core/basesyntax/Truck.java @@ -0,0 +1,12 @@ +package core.basesyntax; + +public class Truck extends Machine { + @Override + public void doWork() { + System.out.println("Machine started its work"); + } + @Override + public void stopWork() { + System.out.println("Machine stopped its work"); + } +} From 828b5fa96edb08aab7a563e3570ddee9e18f96ed Mon Sep 17 00:00:00 2001 From: Mykyta Oleksin <32339836+nacenik@users.noreply.github.com> Date: Fri, 12 May 2023 10:15:08 +0300 Subject: [PATCH 2/3] solution hw-1 --- .github/workflows/ci.yml | 4 ++-- src/main/java/core/basesyntax/Bulldozer.java | 13 +++++++++++++ src/main/java/core/basesyntax/Excavator.java | 14 ++++++++++++++ src/main/java/core/basesyntax/Machine.java | 7 +++++++ src/main/java/core/basesyntax/MainApp.java | 11 ++++++++++- src/main/java/core/basesyntax/Truck.java | 13 +++++++++++++ 6 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 src/main/java/core/basesyntax/Bulldozer.java create mode 100644 src/main/java/core/basesyntax/Excavator.java create mode 100644 src/main/java/core/basesyntax/Machine.java create mode 100644 src/main/java/core/basesyntax/Truck.java diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ead0ef36a..282f50ac5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,10 +8,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v2 with: - java-version: '11' + java-version: '17' distribution: 'adopt' cache: maven - name: Build with Maven diff --git a/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java new file mode 100644 index 000000000..c53f73a34 --- /dev/null +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -0,0 +1,13 @@ +package core.basesyntax; + +public class Bulldozer extends Machine { + @Override + public void doWork() { + System.out.println("Machine started its work"); + } + + @Override + public void stopWork() { + System.out.println("Machine 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..8c46df714 --- /dev/null +++ b/src/main/java/core/basesyntax/Excavator.java @@ -0,0 +1,14 @@ +package core.basesyntax; + +public class Excavator extends Machine { + @Override + public void doWork() { + System.out.println("Machine started its work"); + } + + @Override + public void stopWork() { + System.out.println("Machine 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..4219699a5 --- /dev/null +++ b/src/main/java/core/basesyntax/Machine.java @@ -0,0 +1,7 @@ +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..03dd23075 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -1,5 +1,14 @@ package core.basesyntax; public class MainApp { - + public static void main(String[] args) { + Machine track = new Truck(); + Machine excavator = new Excavator(); + Machine bulldozer = new Bulldozer(); + Machine [] machines = new Machine [] {track,bulldozer,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..ce20ed806 --- /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("Machine started its work"); + } + + @Override + public void stopWork() { + System.out.println("Machine stopped its work"); + } +} From fe6866515cd2a0951fe95109720ee362df323029 Mon Sep 17 00:00:00 2001 From: evgenkolner Date: Tue, 25 Jul 2023 15:44:31 +0300 Subject: [PATCH 3/3] fixed the mistakes --- src/main/java/core/basesyntax/Bulldozer.java | 7 ++----- src/main/java/core/basesyntax/Excavator.java | 4 ++-- src/main/java/core/basesyntax/Machine.java | 7 +------ src/main/java/core/basesyntax/MainApp.java | 11 ++++++++++- src/main/java/core/basesyntax/Truck.java | 7 ++----- 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java index a9099a0e4..9646b3b63 100644 --- a/src/main/java/core/basesyntax/Bulldozer.java +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -3,14 +3,11 @@ public class Bulldozer extends Machine { @Override public void doWork() { - System.out.println("Machine started its work"); + System.out.println("Bulldozer started its work"); } -<<<<<<< HEAD -======= ->>>>>>> origin/hw-1 @Override public void stopWork() { - System.out.println("Machine stopped its work"); + System.out.println("Bulldozer started its work"); } } diff --git a/src/main/java/core/basesyntax/Excavator.java b/src/main/java/core/basesyntax/Excavator.java index 8c46df714..6c52aa1ba 100644 --- a/src/main/java/core/basesyntax/Excavator.java +++ b/src/main/java/core/basesyntax/Excavator.java @@ -3,12 +3,12 @@ public class Excavator extends Machine { @Override public void doWork() { - System.out.println("Machine started its work"); + System.out.println("Excavator started its work"); } @Override public void stopWork() { - System.out.println("Machine stopped its work"); + System.out.println("Excavator stopped its work"); } } diff --git a/src/main/java/core/basesyntax/Machine.java b/src/main/java/core/basesyntax/Machine.java index f9be636d1..8f60ccf51 100644 --- a/src/main/java/core/basesyntax/Machine.java +++ b/src/main/java/core/basesyntax/Machine.java @@ -2,12 +2,7 @@ public abstract class Machine { public abstract void doWork(); -<<<<<<< HEAD public abstract void stopWork(); -======= - public abstract void stopWork(); - - ->>>>>>> origin/hw-1 } + diff --git a/src/main/java/core/basesyntax/MainApp.java b/src/main/java/core/basesyntax/MainApp.java index f99e9a019..78163e059 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -1,5 +1,14 @@ package core.basesyntax; public class MainApp { - + public static void main(String[] args) { + Machine truck = new Truck(); + Machine bulldozer = new Bulldozer(); + Machine excavator = new Excavator(); + Machine [] machines = new Machine[] {truck,bulldozer,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 index 8731a2642..0df9fc7fd 100644 --- a/src/main/java/core/basesyntax/Truck.java +++ b/src/main/java/core/basesyntax/Truck.java @@ -3,14 +3,11 @@ public class Truck extends Machine { @Override public void doWork() { - System.out.println("Machine started its work"); + System.out.println("Truck started its work"); } -<<<<<<< HEAD -======= ->>>>>>> origin/hw-1 @Override public void stopWork() { - System.out.println("Machine stopped its work"); + System.out.println("Truck started its work"); } }