From dbfc13e13d7fbf6f3425f837251176f37b06b1ca Mon Sep 17 00:00:00 2001 From: Alex-zzzz <141009519+Alex-zzzz@users.noreply.github.com> Date: Mon, 31 Jul 2023 14:11:16 +0300 Subject: [PATCH 01/14] First --- src/main/java/core/basesyntax/Bulldozer.java | 13 +++++++++++++ src/main/java/core/basesyntax/Excavator.java | 18 ++++++++++++++++++ src/main/java/core/basesyntax/Machine.java | 6 ++++++ src/main/java/core/basesyntax/MainApp.java | 7 +++++++ src/main/java/core/basesyntax/Truck.java | 13 +++++++++++++ 5 files changed, 57 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..1005d8fd4 --- /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("Bulldozer start work"); + } + + @Override + public void stopWork() { + System.out.println("Bulldozer stop 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..cccbb44d5 --- /dev/null +++ b/src/main/java/core/basesyntax/Excavator.java @@ -0,0 +1,18 @@ +package core.basesyntax; + +public class Excavator extends Machine { + @Override + public int hashCode() { + return super.hashCode(); + } + + @Override + public void doWork() { + System.out.println("Excavator start work"); + } + + @Override + public void stopWork() { + System.out.println("Excavator stop 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..71b049dc8 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -1,5 +1,12 @@ package core.basesyntax; public class MainApp { + Machine[] machine = {new Bulldozer(), new Excavator(), new Truck()}; + public void run() { + for (int i=0; i <= machine.length; i++){ + machine[i].doWork(); + machine[i].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..11f7d0226 --- /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 start work"); + } + + @Override + public void stopWork() { + System.out.println("Truck stop work"); + } +} From c00e1428475e37e0f75f463fc81e101c0e3c3273 Mon Sep 17 00:00:00 2001 From: Alex-zzzz <141009519+Alex-zzzz@users.noreply.github.com> Date: Mon, 31 Jul 2023 14:23:47 +0300 Subject: [PATCH 02/14] Add files via upload --- src/main/java/core/basesyntax/Bulldozer.java | 13 +++++++++++++ src/main/java/core/basesyntax/Excavator.java | 18 ++++++++++++++++++ src/main/java/core/basesyntax/Machine.java | 6 ++++++ src/main/java/core/basesyntax/MainApp.java | 17 ++++++++++++----- src/main/java/core/basesyntax/Truck.java | 13 +++++++++++++ 5 files changed, 62 insertions(+), 5 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/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java new file mode 100644 index 000000000..7e4962fbe --- /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("Bulldozer start work"); + } + + @Override + public void stopWork() { + System.out.println("Bulldozer stop 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..666ac4bc6 --- /dev/null +++ b/src/main/java/core/basesyntax/Excavator.java @@ -0,0 +1,18 @@ +package core.basesyntax; + +public class Excavator extends Machine { + @Override + public int hashCode() { + return super.hashCode(); + } + + @Override + public void doWork() { + System.out.println("Excavator start work"); + } + + @Override + public void stopWork() { + System.out.println("Excavator stop 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..b3c81d24e --- /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..4c2746143 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -1,5 +1,12 @@ -package core.basesyntax; - -public class MainApp { - -} +package core.basesyntax; + +public class MainApp { + Machine[] machine = {new Bulldozer(), new Excavator(), new Truck()}; + + public void run() { + for (int i=0; i <= machine.length; i++){ + machine[i].doWork(); + machine[i].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..f6af57a67 --- /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 start work"); + } + + @Override + public void stopWork() { + System.out.println("Truck stop work"); + } +} From cdace945fe1112d3b079e2c5887dac31a40a5841 Mon Sep 17 00:00:00 2001 From: Alex-zzzz <141009519+Alex-zzzz@users.noreply.github.com> Date: Mon, 31 Jul 2023 17:34:33 +0300 Subject: [PATCH 03/14] Update Excavator.java --- src/main/java/core/basesyntax/Excavator.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/core/basesyntax/Excavator.java b/src/main/java/core/basesyntax/Excavator.java index 1dd565330..c0125d13f 100644 --- a/src/main/java/core/basesyntax/Excavator.java +++ b/src/main/java/core/basesyntax/Excavator.java @@ -1,4 +1,3 @@ -<<<<<<< HEAD package core.basesyntax; public class Excavator extends Machine { @@ -36,4 +35,4 @@ public void stopWork() { System.out.println("Excavator stop work"); } } ->>>>>>> origin/master + From a1019ff2edb924f581b2e4991ce6b67f279c378f Mon Sep 17 00:00:00 2001 From: Alex-zzzz <141009519+Alex-zzzz@users.noreply.github.com> Date: Mon, 31 Jul 2023 17:35:43 +0300 Subject: [PATCH 04/14] Update Bulldozer.java --- src/main/java/core/basesyntax/Bulldozer.java | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java index 3f3bfbb7d..d4ee8052c 100644 --- a/src/main/java/core/basesyntax/Bulldozer.java +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -1,4 +1,3 @@ -<<<<<<< HEAD package core.basesyntax; public class Bulldozer extends Machine{ @@ -12,18 +11,4 @@ public void stopWork() { System.out.println("Bulldozer stop work"); } } -======= -package core.basesyntax; - -public class Bulldozer extends Machine{ - @Override - public void doWork() { - System.out.println("Bulldozer start work"); - } - @Override - public void stopWork() { - System.out.println("Bulldozer stop work"); - } -} ->>>>>>> origin/master From 7479842ae085ce77909ab7d2c523dd2e3b0440a2 Mon Sep 17 00:00:00 2001 From: Alex-zzzz <141009519+Alex-zzzz@users.noreply.github.com> Date: Mon, 31 Jul 2023 17:36:11 +0300 Subject: [PATCH 05/14] Update Excavator.java --- src/main/java/core/basesyntax/Excavator.java | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/main/java/core/basesyntax/Excavator.java b/src/main/java/core/basesyntax/Excavator.java index c0125d13f..58166885d 100644 --- a/src/main/java/core/basesyntax/Excavator.java +++ b/src/main/java/core/basesyntax/Excavator.java @@ -16,23 +16,4 @@ public void stopWork() { System.out.println("Excavator stop work"); } } -======= -package core.basesyntax; - -public class Excavator extends Machine { - @Override - public int hashCode() { - return super.hashCode(); - } - - @Override - public void doWork() { - System.out.println("Excavator start work"); - } - - @Override - public void stopWork() { - System.out.println("Excavator stop work"); - } -} From 62d1b4672ad21ff633c92b9a3370c61d158dcb91 Mon Sep 17 00:00:00 2001 From: Alex-zzzz <141009519+Alex-zzzz@users.noreply.github.com> Date: Mon, 31 Jul 2023 17:36:54 +0300 Subject: [PATCH 06/14] Update MainApp.java --- src/main/java/core/basesyntax/MainApp.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/core/basesyntax/MainApp.java b/src/main/java/core/basesyntax/MainApp.java index 71b049dc8..1efb56217 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -3,7 +3,7 @@ public class MainApp { Machine[] machine = {new Bulldozer(), new Excavator(), new Truck()}; - public void run() { + { for (int i=0; i <= machine.length; i++){ machine[i].doWork(); machine[i].stopWork(); From 753629ac441fc73b0cd555cf4c58444daea375e6 Mon Sep 17 00:00:00 2001 From: Alex-zzzz <141009519+Alex-zzzz@users.noreply.github.com> Date: Tue, 1 Aug 2023 09:10:20 +0300 Subject: [PATCH 07/14] Update Excavator.java Delete Override hashcode --- src/main/java/core/basesyntax/Excavator.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/core/basesyntax/Excavator.java b/src/main/java/core/basesyntax/Excavator.java index 58166885d..f777f6d05 100644 --- a/src/main/java/core/basesyntax/Excavator.java +++ b/src/main/java/core/basesyntax/Excavator.java @@ -1,11 +1,7 @@ package core.basesyntax; public class Excavator extends Machine { - @Override - public int hashCode() { - return super.hashCode(); - } - + @Override public void doWork() { System.out.println("Excavator start work"); From c8c158a24da38ee963c5b5e5d0a4f2b538d01a2f Mon Sep 17 00:00:00 2001 From: Alex-zzzz <141009519+Alex-zzzz@users.noreply.github.com> Date: Tue, 1 Aug 2023 09:12:22 +0300 Subject: [PATCH 08/14] Update MainApp.java Change fori to foreach --- src/main/java/core/basesyntax/MainApp.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/core/basesyntax/MainApp.java b/src/main/java/core/basesyntax/MainApp.java index 1efb56217..a48f4d786 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -4,9 +4,10 @@ public class MainApp { Machine[] machine = {new Bulldozer(), new Excavator(), new Truck()}; { - for (int i=0; i <= machine.length; i++){ - machine[i].doWork(); - machine[i].stopWork(); + for (Machine i : machine) + { + i.doWork(); + i.stopWork(); } } } From 4ec86fd30cf64760270d8a85440862bae2de615f Mon Sep 17 00:00:00 2001 From: Alex-zzzz <141009519+Alex-zzzz@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:44:07 +0300 Subject: [PATCH 09/14] Update Machine.java i put empty line between methods --- src/main/java/core/basesyntax/Machine.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/core/basesyntax/Machine.java b/src/main/java/core/basesyntax/Machine.java index 5a62715c2..c0c367808 100644 --- a/src/main/java/core/basesyntax/Machine.java +++ b/src/main/java/core/basesyntax/Machine.java @@ -2,5 +2,6 @@ public abstract class Machine { public abstract void doWork(); + public abstract void stopWork(); } From 1d2e08895f7166c69c1e0c8a540815a6f8beec5e Mon Sep 17 00:00:00 2001 From: Alex-zzzz <141009519+Alex-zzzz@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:48:43 +0300 Subject: [PATCH 10/14] Update MainApp.java chanhe loop. I checked in development environment it works --- src/main/java/core/basesyntax/MainApp.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/core/basesyntax/MainApp.java b/src/main/java/core/basesyntax/MainApp.java index a48f4d786..debd5991b 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -1,13 +1,12 @@ package core.basesyntax; public class MainApp { - Machine[] machine = {new Bulldozer(), new Excavator(), new Truck()}; + Machine[] machines = {new Bulldozer(), new Excavator(), new Truck()}; - { - for (Machine i : machine) - { - i.doWork(); - i.stopWork(); + + for (Machine machine : machines) { + machine.doWork(); + machine.stopWork(); } - } + } From ac0f9bb4a94932ea543dbec5a23a1401332801f1 Mon Sep 17 00:00:00 2001 From: Alex-zzzz <141009519+Alex-zzzz@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:54:30 +0300 Subject: [PATCH 11/14] Update Bulldozer.java add whitespace --- src/main/java/core/basesyntax/Bulldozer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java index d4ee8052c..5f2ae6170 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 start work"); From c130a60465941b638950874f6ec40e50e9dbdf84 Mon Sep 17 00:00:00 2001 From: Alex-zzzz <141009519+Alex-zzzz@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:56:13 +0300 Subject: [PATCH 12/14] Update Truck.java --- src/main/java/core/basesyntax/Truck.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/core/basesyntax/Truck.java b/src/main/java/core/basesyntax/Truck.java index 11f7d0226..76c8fa1fd 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 start work"); From 79e0ef8487d12029a7c950b5ae552df7bc4786d7 Mon Sep 17 00:00:00 2001 From: Alex-zzzz <141009519+Alex-zzzz@users.noreply.github.com> Date: Wed, 2 Aug 2023 20:27:19 +0300 Subject: [PATCH 13/14] Fixed All code style problem, maven check complete --- src/main/java/core/basesyntax/Bulldozer.java | 17 ++--------------- src/main/java/core/basesyntax/Excavator.java | 20 -------------------- src/main/java/core/basesyntax/Machine.java | 2 ++ src/main/java/core/basesyntax/MainApp.java | 10 +++++----- src/main/java/core/basesyntax/Truck.java | 2 +- 5 files changed, 10 insertions(+), 41 deletions(-) diff --git a/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java index 3f3bfbb7d..05fcc4d0c 100644 --- a/src/main/java/core/basesyntax/Bulldozer.java +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -1,7 +1,6 @@ -<<<<<<< HEAD package core.basesyntax; -public class Bulldozer extends Machine{ +public class Bulldozer extends Machine { @Override public void doWork() { System.out.println("Bulldozer start work"); @@ -12,18 +11,6 @@ public void stopWork() { System.out.println("Bulldozer stop work"); } } -======= -package core.basesyntax; -public class Bulldozer extends Machine{ - @Override - public void doWork() { - System.out.println("Bulldozer start work"); - } - @Override - public void stopWork() { - System.out.println("Bulldozer stop work"); - } -} ->>>>>>> origin/master + diff --git a/src/main/java/core/basesyntax/Excavator.java b/src/main/java/core/basesyntax/Excavator.java index 1dd565330..58166885d 100644 --- a/src/main/java/core/basesyntax/Excavator.java +++ b/src/main/java/core/basesyntax/Excavator.java @@ -1,4 +1,3 @@ -<<<<<<< HEAD package core.basesyntax; public class Excavator extends Machine { @@ -17,23 +16,4 @@ public void stopWork() { System.out.println("Excavator stop work"); } } -======= -package core.basesyntax; -public class Excavator extends Machine { - @Override - public int hashCode() { - return super.hashCode(); - } - - @Override - public void doWork() { - System.out.println("Excavator start work"); - } - - @Override - public void stopWork() { - System.out.println("Excavator stop work"); - } -} ->>>>>>> origin/master diff --git a/src/main/java/core/basesyntax/Machine.java b/src/main/java/core/basesyntax/Machine.java index 5a62715c2..92ac7d520 100644 --- a/src/main/java/core/basesyntax/Machine.java +++ b/src/main/java/core/basesyntax/Machine.java @@ -2,5 +2,7 @@ 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 71b049dc8..a120103ca 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -1,12 +1,12 @@ package core.basesyntax; public class MainApp { - Machine[] machine = {new Bulldozer(), new Excavator(), new Truck()}; + public static void main(String[] args) { + Machine[] machines = {new Bulldozer(), new Excavator(), new Truck()}; - public void run() { - for (int i=0; i <= machine.length; i++){ - machine[i].doWork(); - machine[i].stopWork(); + 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 11f7d0226..76c8fa1fd 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 start work"); From cbfd6a2d240b30b223c748fd8731c3914fae137b Mon Sep 17 00:00:00 2001 From: Alex-zzzz <141009519+Alex-zzzz@users.noreply.github.com> Date: Wed, 2 Aug 2023 20:29:03 +0300 Subject: [PATCH 14/14] Fixed All code style problem, maven check complete --- src/main/java/core/basesyntax/Truck.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/core/basesyntax/Truck.java b/src/main/java/core/basesyntax/Truck.java index 76c8fa1fd..3fe1b8ded 100644 --- a/src/main/java/core/basesyntax/Truck.java +++ b/src/main/java/core/basesyntax/Truck.java @@ -5,7 +5,7 @@ public class Truck extends Machine { public void doWork() { System.out.println("Truck start work"); } - + @Override public void stopWork() { System.out.println("Truck stop work");