From b2d4442a3186e27d1f0111a324dd26660c27f821 Mon Sep 17 00:00:00 2001 From: Daniil Medvediev Date: Fri, 25 Oct 2024 18:19:16 +0200 Subject: [PATCH 1/2] mmm --- src/main/java/core/basesyntax/Bulldozer.java | 23 ++++++++++++++++++++ src/main/java/core/basesyntax/Excavator.java | 15 +++++++++++++ src/main/java/core/basesyntax/Machine.java | 7 ++++++ src/main/java/core/basesyntax/MainApp.java | 13 ++++++++++- src/main/java/core/basesyntax/Truck.java | 15 +++++++++++++ 5 files changed, 72 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/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..58aaa0bb9 --- /dev/null +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -0,0 +1,23 @@ +package core.basesyntax; + +public class Bulldozer extends Machine { + @Override + public void doWork() { + System.out.println("The truck has started to shallow digging and ditching; " + + "short-range transportation of material; " + + "spreading soil dumped from trucks; " + + "rough grading; " + + "removing trees, stumps, and boulders; " + + "and cleaning and leveling around loading equipment."); + } + + @Override + public void stopWork() { + System.out.println("The truck has stopped to shallow digging and ditching; " + + "short-range transportation of material; " + + "spreading soil dumped from trucks; " + + "rough grading; " + + "removing trees, stumps, and boulders; " + + "and cleaning and leveling around loading equipment."); + } +} \ No newline at end of file diff --git a/src/main/java/core/basesyntax/Excavator.java b/src/main/java/core/basesyntax/Excavator.java new file mode 100644 index 000000000..ae696214e --- /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("The excavator has started digging trenches " + + "and breaking holes to lifting away waste and excavating mines."); + } + + @Override + public void stopWork() { + System.out.println("The excavator has stopped digging trenches " + + "and breaking holes to lifting away waste and excavating mines."); + } +} \ No newline at end of file diff --git a/src/main/java/core/basesyntax/Machine.java b/src/main/java/core/basesyntax/Machine.java new file mode 100644 index 000000000..c33b80cd4 --- /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(); +} \ No newline at end of file diff --git a/src/main/java/core/basesyntax/MainApp.java b/src/main/java/core/basesyntax/MainApp.java index f99e9a019..68c865fbb 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -1,5 +1,16 @@ package core.basesyntax; public class MainApp { + public static void main(String[] args) { + Machine excavator = new Excavator(); + Machine truck = new Truck(); + Machine bulldozer = new Bulldozer(); + Machine[] machines = {excavator, truck, bulldozer}; -} + for (Machine machine : machines) { + machine.doWork(); + machine.stopWork(); + } + } + +} \ 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..b18f7b154 --- /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("The truck has started to transport freight," + + " carry specialized payloads, or perform other utilitarian work."); + } + + @Override + public void stopWork() { + System.out.println("The truck has stopped to transport freight," + + " carry specialized payloads and perform other utilitarian work."); + } +} \ No newline at end of file From 08ef581ccbf9bbb43e8a9b57125f3498bdaa9e8d Mon Sep 17 00:00:00 2001 From: Daniil Medvediev Date: Wed, 30 Oct 2024 21:11:45 +0100 Subject: [PATCH 2/2] mmmm --- src/main/java/core/basesyntax/Bulldozer.java | 2 +- src/main/java/core/basesyntax/Excavator.java | 2 +- src/main/java/core/basesyntax/Machine.java | 2 +- src/main/java/core/basesyntax/MainApp.java | 2 +- src/main/java/core/basesyntax/Truck.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/core/basesyntax/Bulldozer.java b/src/main/java/core/basesyntax/Bulldozer.java index 58aaa0bb9..54582ec11 100644 --- a/src/main/java/core/basesyntax/Bulldozer.java +++ b/src/main/java/core/basesyntax/Bulldozer.java @@ -20,4 +20,4 @@ public void stopWork() { + "removing trees, stumps, and boulders; " + "and cleaning and leveling around loading equipment."); } -} \ No newline at end of file +} diff --git a/src/main/java/core/basesyntax/Excavator.java b/src/main/java/core/basesyntax/Excavator.java index ae696214e..3c889d421 100644 --- a/src/main/java/core/basesyntax/Excavator.java +++ b/src/main/java/core/basesyntax/Excavator.java @@ -12,4 +12,4 @@ public void stopWork() { System.out.println("The excavator has stopped digging trenches " + "and breaking holes to lifting away waste and excavating mines."); } -} \ No newline at end of file +} diff --git a/src/main/java/core/basesyntax/Machine.java b/src/main/java/core/basesyntax/Machine.java index c33b80cd4..cad5be453 100644 --- a/src/main/java/core/basesyntax/Machine.java +++ b/src/main/java/core/basesyntax/Machine.java @@ -4,4 +4,4 @@ public abstract class Machine { public abstract void doWork(); public abstract void stopWork(); -} \ No newline at end of file +} diff --git a/src/main/java/core/basesyntax/MainApp.java b/src/main/java/core/basesyntax/MainApp.java index 68c865fbb..79847efbf 100644 --- a/src/main/java/core/basesyntax/MainApp.java +++ b/src/main/java/core/basesyntax/MainApp.java @@ -13,4 +13,4 @@ public static void main(String[] args) { } } -} \ 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 b18f7b154..614005c55 100644 --- a/src/main/java/core/basesyntax/Truck.java +++ b/src/main/java/core/basesyntax/Truck.java @@ -12,4 +12,4 @@ public void stopWork() { System.out.println("The truck has stopped to transport freight," + " carry specialized payloads and perform other utilitarian work."); } -} \ No newline at end of file +}