From 540435fa6b528520a870800f6a5911722f198f77 Mon Sep 17 00:00:00 2001 From: Volodymyr Date: Mon, 3 Nov 2025 22:47:44 +0200 Subject: [PATCH 1/5] added class and methods --- src/main/java/core/basesyntax/Bulldozer.java | 4 ++++ src/main/java/core/basesyntax/Excavator.java | 4 ++++ src/main/java/core/basesyntax/Machine.java | 8 ++++++++ src/main/java/core/basesyntax/Truck.java | 4 ++++ 4 files changed, 20 insertions(+) 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/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java new file mode 100644 index 000000000..e5e0123a2 --- /dev/null +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -0,0 +1,4 @@ +package core.basesyntax; + +public abstract class Bulldozer extends Machine { +} diff --git a/src/main/java/core/basesyntax/Excavator.java b/src/main/java/core/basesyntax/Excavator.java new file mode 100644 index 000000000..a3f0b4bba --- /dev/null +++ b/src/main/java/core/basesyntax/Excavator.java @@ -0,0 +1,4 @@ +package core.basesyntax; + +public abstract class Excavator extends Machine{ +} diff --git a/src/main/java/core/basesyntax/Machine.java b/src/main/java/core/basesyntax/Machine.java new file mode 100644 index 000000000..4aea2f871 --- /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/Truck.java b/src/main/java/core/basesyntax/Truck.java new file mode 100644 index 000000000..20b661a5d --- /dev/null +++ b/src/main/java/core/basesyntax/Truck.java @@ -0,0 +1,4 @@ +package core.basesyntax; + +public abstract class Truck extends Machine { +} From af7823fbca36482e4cb4feee3588f4a83a1a8e3d Mon Sep 17 00:00:00 2001 From: Volodymyr Date: Mon, 3 Nov 2025 22:59:02 +0200 Subject: [PATCH 2/5] added methods in classes --- src/main/java/core/basesyntax/Bulldozer.java | 9 +++++++++ src/main/java/core/basesyntax/Excavator.java | 9 +++++++++ src/main/java/core/basesyntax/Truck.java | 9 +++++++++ 3 files changed, 27 insertions(+) diff --git a/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java index e5e0123a2..fa27587a8 100644 --- a/src/main/java/core/basesyntax/Bulldozer.java +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -1,4 +1,13 @@ package core.basesyntax; public abstract class Bulldozer extends Machine { + @Override + public void doWork() { + System.out.println("Bulldozer started its work"); + } + + @Override + public void stopWork() { + System.out.println("Bulldozer stopped working"); + } } diff --git a/src/main/java/core/basesyntax/Excavator.java b/src/main/java/core/basesyntax/Excavator.java index a3f0b4bba..0a1e5a7ea 100644 --- a/src/main/java/core/basesyntax/Excavator.java +++ b/src/main/java/core/basesyntax/Excavator.java @@ -1,4 +1,13 @@ package core.basesyntax; public abstract class Excavator extends Machine{ + @Override + public void doWork() { + System.out.println("Excavator started its work"); + } + + @Override + public void stopWork() { + System.out.println("Excavator stopped working"); + } } diff --git a/src/main/java/core/basesyntax/Truck.java b/src/main/java/core/basesyntax/Truck.java index 20b661a5d..3eee23131 100644 --- a/src/main/java/core/basesyntax/Truck.java +++ b/src/main/java/core/basesyntax/Truck.java @@ -1,4 +1,13 @@ package core.basesyntax; public abstract class Truck extends Machine { + @Override + public void doWork() { + System.out.println("Truck started its work"); + } + + @Override + public void stopWork() { + System.out.println("Truck stopped working"); + } } From 55ef7f027bf1dc9a9595bbc13f8d292c8286a7ab Mon Sep 17 00:00:00 2001 From: Volodymyr Date: Mon, 3 Nov 2025 23:02:32 +0200 Subject: [PATCH 3/5] added array --- src/main/java/core/basesyntax/MainApp.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/core/basesyntax/MainApp.java b/src/main/java/core/basesyntax/MainApp.java index f99e9a019..3e5487b31 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -2,4 +2,6 @@ public class MainApp { + String[] Machine = {"Truck", "Excavator", "Bulldozer"}; + } From b80ac61d6b3fb603868f1794b4baefafe10cde09 Mon Sep 17 00:00:00 2001 From: Volodymyr Date: Wed, 5 Nov 2025 23:53:20 +0200 Subject: [PATCH 4/5] added arrays and cycle --- src/main/java/core/basesyntax/Bulldozer.java | 2 +- src/main/java/core/basesyntax/Excavator.java | 2 +- src/main/java/core/basesyntax/MainApp.java | 8 +++++++- src/main/java/core/basesyntax/Truck.java | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java index fa27587a8..51c943063 100644 --- a/src/main/java/core/basesyntax/Bulldozer.java +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -1,6 +1,6 @@ package core.basesyntax; -public abstract class Bulldozer extends Machine { +public class Bulldozer extends Machine { @Override public void doWork() { 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 0a1e5a7ea..412ab9bf0 100644 --- a/src/main/java/core/basesyntax/Excavator.java +++ b/src/main/java/core/basesyntax/Excavator.java @@ -1,6 +1,6 @@ package core.basesyntax; -public abstract class Excavator extends Machine{ +public class Excavator extends Machine{ @Override public void doWork() { System.out.println("Excavator started its work"); diff --git a/src/main/java/core/basesyntax/MainApp.java b/src/main/java/core/basesyntax/MainApp.java index 3e5487b31..87112e0f0 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -1,7 +1,13 @@ package core.basesyntax; public class MainApp { + public static void main(String[] args) { - String[] Machine = {"Truck", "Excavator", "Bulldozer"}; + Machine[] machines = {new Truck(), new Bulldozer(), 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 index 3eee23131..9ef24dc3d 100644 --- a/src/main/java/core/basesyntax/Truck.java +++ b/src/main/java/core/basesyntax/Truck.java @@ -1,6 +1,6 @@ package core.basesyntax; -public abstract class Truck extends Machine { +public class Truck extends Machine { @Override public void doWork() { System.out.println("Truck started its work"); From 87164e465c3f9d6ccc641694a779d9630c7997a0 Mon Sep 17 00:00:00 2001 From: Volodymyr Date: Thu, 6 Nov 2025 00:09:56 +0200 Subject: [PATCH 5/5] Fix Checkstyle formatting issues --- src/main/java/core/basesyntax/Bulldozer.java | 2 +- src/main/java/core/basesyntax/Excavator.java | 2 +- src/main/java/core/basesyntax/MainApp.java | 2 +- src/main/java/core/basesyntax/Truck.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java index 51c943063..3e574427d 100644 --- a/src/main/java/core/basesyntax/Bulldozer.java +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -1,6 +1,6 @@ package core.basesyntax; -public class Bulldozer extends Machine { +public class Bulldozer extends Machine { @Override public void doWork() { 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 412ab9bf0..99d036aa1 100644 --- a/src/main/java/core/basesyntax/Excavator.java +++ b/src/main/java/core/basesyntax/Excavator.java @@ -1,6 +1,6 @@ package core.basesyntax; -public class Excavator extends Machine{ +public class Excavator extends Machine { @Override public void doWork() { System.out.println("Excavator started its work"); diff --git a/src/main/java/core/basesyntax/MainApp.java b/src/main/java/core/basesyntax/MainApp.java index 87112e0f0..7b731ec81 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -5,7 +5,7 @@ public static void main(String[] args) { Machine[] machines = {new Truck(), new Bulldozer(), new Excavator()}; - for(Machine machine : machines) { + 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 9ef24dc3d..055ecf57e 100644 --- a/src/main/java/core/basesyntax/Truck.java +++ b/src/main/java/core/basesyntax/Truck.java @@ -1,6 +1,6 @@ package core.basesyntax; -public class Truck extends Machine { +public class Truck extends Machine { @Override public void doWork() { System.out.println("Truck started its work");