From 247cfee3bad99becf1be3f5d931abefdba3eefd9 Mon Sep 17 00:00:00 2001 From: Kostia Ibraiev Date: Tue, 12 Sep 2023 20:10:12 -0600 Subject: [PATCH 1/7] "added Machine class" --- src/main/java/core/basesyntax/Machine.java | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/main/java/core/basesyntax/Machine.java diff --git a/src/main/java/core/basesyntax/Machine.java b/src/main/java/core/basesyntax/Machine.java new file mode 100644 index 000000000..5629628b6 --- /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(); +} + From 21f0e7181e01625a057a3ee4388f2f766a8d0e77 Mon Sep 17 00:00:00 2001 From: Kostia Ibraiev Date: Tue, 12 Sep 2023 21:43:02 -0600 Subject: [PATCH 2/7] machine class created --- src/main/java/core/basesyntax/MainApp.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/core/basesyntax/MainApp.java b/src/main/java/core/basesyntax/MainApp.java index f99e9a019..9cefe6307 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -1,5 +1,8 @@ package core.basesyntax; public class MainApp { + public static void main(String[] args) { + + } } From 768e8abf4673910fa19402f23ee7eb675ac6fe5d Mon Sep 17 00:00:00 2001 From: Kostia Ibraiev Date: Tue, 12 Sep 2023 21:48:10 -0600 Subject: [PATCH 3/7] test commit --- src/main/java/core/basesyntax/MainApp.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/core/basesyntax/MainApp.java b/src/main/java/core/basesyntax/MainApp.java index 9cefe6307..a92b671a6 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -2,6 +2,7 @@ public class MainApp { public static void main(String[] args) { + System.out.println("test"); } From 47aec979366e983701b04dfaf31da87353ff09dc Mon Sep 17 00:00:00 2001 From: Kostia Ibraiev Date: Tue, 12 Sep 2023 22:01:33 -0600 Subject: [PATCH 4/7] all classes are created, main class is completed --- src/main/java/core/basesyntax/Bulldozer.java | 15 +++++++++++++++ src/main/java/core/basesyntax/Excavator.java | 15 +++++++++++++++ src/main/java/core/basesyntax/MainApp.java | 12 +++++++++++- src/main/java/core/basesyntax/Truck.java | 15 +++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) 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/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..373c13d9b --- /dev/null +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -0,0 +1,15 @@ +package core.basesyntax; + +public class Bulldozer extends Machine{ + + @Override + public void doWork() { + System.out.println("Bulldozer works");; + } + + @Override + public void stopWork() { + System.out.println("Bulldozer stops");; + } + +} diff --git a/src/main/java/core/basesyntax/Excavator.java b/src/main/java/core/basesyntax/Excavator.java new file mode 100644 index 000000000..c40496822 --- /dev/null +++ b/src/main/java/core/basesyntax/Excavator.java @@ -0,0 +1,15 @@ +package core.basesyntax; + +public class Excavator extends Machine{ + + @Override + public void doWork() { + System.out.println("Excavator works");; + } + + @Override + public void stopWork() { + System.out.println("Excavator stops");; + } + +} diff --git a/src/main/java/core/basesyntax/MainApp.java b/src/main/java/core/basesyntax/MainApp.java index a92b671a6..a04a0de89 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -2,8 +2,18 @@ public class MainApp { public static void main(String[] args) { - System.out.println("test"); + Machine[] machines = {new Truck(), new Bulldozer(), new Excavator()}; + + for (Machine machine : machines) { + machine.doWork(); + machine.stopWork(); + } + + } } + +//In MainApp class create Machine array with Truck, Bulldozer and Excavator +//and call methods doWork() and stopWork() in a loop. \ No newline at end of file diff --git a/src/main/java/core/basesyntax/Truck.java b/src/main/java/core/basesyntax/Truck.java new file mode 100644 index 000000000..ef5f9dc70 --- /dev/null +++ b/src/main/java/core/basesyntax/Truck.java @@ -0,0 +1,15 @@ +package core.basesyntax; + +public class Truck extends Machine { + + @Override + public void doWork() { + System.out.println("Truck works");; + } + + @Override + public void stopWork() { + System.out.println("Truck stops");; + } + +} From 74508a9be2cf7242f5e63403817c89edb0fdcc25 Mon Sep 17 00:00:00 2001 From: Kostia Ibraiev Date: Wed, 13 Sep 2023 11:25:12 -0600 Subject: [PATCH 5/7] Indentation made correct --- src/main/java/core/basesyntax/Bulldozer.java | 16 ++++++++-------- src/main/java/core/basesyntax/Excavator.java | 19 ++++++++++--------- src/main/java/core/basesyntax/Machine.java | 1 - src/main/java/core/basesyntax/MainApp.java | 19 ++++++++----------- src/main/java/core/basesyntax/Truck.java | 16 ++++++++-------- 5 files changed, 34 insertions(+), 37 deletions(-) diff --git a/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java index 373c13d9b..60b88c240 100644 --- a/src/main/java/core/basesyntax/Bulldozer.java +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -2,14 +2,14 @@ public class Bulldozer extends Machine{ - @Override - public void doWork() { - System.out.println("Bulldozer works");; - } + @Override + public void doWork() { + System.out.println("Bulldozer works");; + } - @Override - public void stopWork() { - System.out.println("Bulldozer stops");; - } + @Override + public void stopWork() { + System.out.println("Bulldozer stops");; + } } diff --git a/src/main/java/core/basesyntax/Excavator.java b/src/main/java/core/basesyntax/Excavator.java index c40496822..674b880ca 100644 --- a/src/main/java/core/basesyntax/Excavator.java +++ b/src/main/java/core/basesyntax/Excavator.java @@ -1,15 +1,16 @@ package core.basesyntax; -public class Excavator extends Machine{ +public class Excavator extends Machine { - @Override - public void doWork() { - System.out.println("Excavator works");; - } + @Override + public void doWork() { + System.out.println("Excavator works");; + } - @Override - public void stopWork() { - System.out.println("Excavator stops");; - } + @Override + public void stopWork() { + System.out.println("Excavator stops");; + } + } diff --git a/src/main/java/core/basesyntax/Machine.java b/src/main/java/core/basesyntax/Machine.java index 5629628b6..5a62715c2 100644 --- a/src/main/java/core/basesyntax/Machine.java +++ b/src/main/java/core/basesyntax/Machine.java @@ -4,4 +4,3 @@ 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 a04a0de89..1e2ffa87a 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -1,19 +1,16 @@ package core.basesyntax; public class MainApp { - public static void main(String[] args) { - Machine[] machines = {new Truck(), new Bulldozer(), new Excavator()}; + public static void main(String[] args) { + Machine[] machines = {new Truck(), new Bulldozer(), new Excavator()}; - for (Machine machine : machines) { - machine.doWork(); - machine.stopWork(); - } + for (Machine machine : machines) { + machine.doWork(); + machine.stopWork(); + } - - } + + } } - -//In MainApp class create Machine array with Truck, Bulldozer and Excavator -//and call methods doWork() and stopWork() in a loop. \ No newline at end of file diff --git a/src/main/java/core/basesyntax/Truck.java b/src/main/java/core/basesyntax/Truck.java index ef5f9dc70..adf06e3ad 100644 --- a/src/main/java/core/basesyntax/Truck.java +++ b/src/main/java/core/basesyntax/Truck.java @@ -2,14 +2,14 @@ public class Truck extends Machine { - @Override - public void doWork() { - System.out.println("Truck works");; - } + @Override + public void doWork() { + System.out.println("Truck works"); + } - @Override - public void stopWork() { - System.out.println("Truck stops");; - } + @Override + public void stopWork() { + System.out.println("Truck stops"); + } } From f4245b187e2952e9c633e5edcc75e81f63322224 Mon Sep 17 00:00:00 2001 From: Kostia Ibraiev Date: Wed, 13 Sep 2023 13:06:11 -0600 Subject: [PATCH 6/7] build success --- src/main/java/core/basesyntax/Bulldozer.java | 6 +++--- src/main/java/core/basesyntax/Excavator.java | 4 +--- src/main/java/core/basesyntax/Machine.java | 1 + src/main/java/core/basesyntax/MainApp.java | 6 +----- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java index 60b88c240..d3e3247f9 100644 --- a/src/main/java/core/basesyntax/Bulldozer.java +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -1,15 +1,15 @@ package core.basesyntax; -public class Bulldozer extends Machine{ +public class Bulldozer extends Machine { @Override public void doWork() { - System.out.println("Bulldozer works");; + System.out.println("Bulldozer works"); } @Override public void stopWork() { - System.out.println("Bulldozer stops");; + System.out.println("Bulldozer stops"); } } diff --git a/src/main/java/core/basesyntax/Excavator.java b/src/main/java/core/basesyntax/Excavator.java index 674b880ca..25d6b6538 100644 --- a/src/main/java/core/basesyntax/Excavator.java +++ b/src/main/java/core/basesyntax/Excavator.java @@ -10,7 +10,5 @@ public void doWork() { @Override public void stopWork() { System.out.println("Excavator stops");; - } - - + } } 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(); } diff --git a/src/main/java/core/basesyntax/MainApp.java b/src/main/java/core/basesyntax/MainApp.java index 1e2ffa87a..460063a2f 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -7,10 +7,6 @@ public static void main(String[] args) { for (Machine machine : machines) { machine.doWork(); machine.stopWork(); - } - - - + } } - } From 8efb5e5c41cb4068a72c5466df56e9077a06ea9f Mon Sep 17 00:00:00 2001 From: Kostia Ibraiev Date: Thu, 14 Sep 2023 12:19:25 -0600 Subject: [PATCH 7/7] empty lines deleted --- src/main/java/core/basesyntax/Bulldozer.java | 5 ++--- src/main/java/core/basesyntax/Excavator.java | 5 ++--- src/main/java/core/basesyntax/Truck.java | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java index d3e3247f9..f235768a6 100644 --- a/src/main/java/core/basesyntax/Bulldozer.java +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -1,15 +1,14 @@ package core.basesyntax; public class Bulldozer extends Machine { - @Override public void doWork() { - System.out.println("Bulldozer works"); + System.out.println("Bulldozer works now"); } @Override public void stopWork() { - System.out.println("Bulldozer stops"); + System.out.println("Bulldozer stops working"); } } diff --git a/src/main/java/core/basesyntax/Excavator.java b/src/main/java/core/basesyntax/Excavator.java index 25d6b6538..1fb15aa2d 100644 --- a/src/main/java/core/basesyntax/Excavator.java +++ b/src/main/java/core/basesyntax/Excavator.java @@ -1,14 +1,13 @@ package core.basesyntax; public class Excavator extends Machine { - @Override public void doWork() { - System.out.println("Excavator works");; + System.out.println("Excavator works now"); } @Override public void stopWork() { - System.out.println("Excavator stops");; + System.out.println("Excavator stops working"); } } diff --git a/src/main/java/core/basesyntax/Truck.java b/src/main/java/core/basesyntax/Truck.java index adf06e3ad..a27bf24e5 100644 --- a/src/main/java/core/basesyntax/Truck.java +++ b/src/main/java/core/basesyntax/Truck.java @@ -1,15 +1,14 @@ package core.basesyntax; public class Truck extends Machine { - @Override public void doWork() { - System.out.println("Truck works"); + System.out.println("Truck works now"); } @Override public void stopWork() { - System.out.println("Truck stops"); + System.out.println("Truck stops working"); } }