Skip to content

Commit

Permalink
Created class Machine containing methods public abstract void doWork(…
Browse files Browse the repository at this point in the history
…) and public abstract void stopWork().

Add classes Truck, Bulldozer, Excavator that will inherit from Machine and override doWork() and stopWork() methods.
In Main class was created Machine array with Truck, Buldozer and Excavator and call methods doWork() and stopWork() in a loop.
  • Loading branch information
PeresadaKostya committed Jul 25, 2023
1 parent 278ba17 commit 2970b99
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/main/java/core/basesyntax/Buldozer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package core.basesyntax;

public class Buldozer extends Machine{
@Override
public void doWork() {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/core/basesyntax/Excavator.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package core.basesyntax;

public class Excavator extends Machine {
@Override
public void doWork() {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/core/basesyntax/Machine.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package core.basesyntax;

public abstract class Machine {
public abstract void doWork();
public abstract void stopwork();
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/core/basesyntax/MainApp.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package core.basesyntax;

public class MainApp {
Truck truck = new Truck();
Buldozer buldozer = new Buldozer();
Excavator excavator = new Excavator();

public void work() {
Machine [] machine = new Machine[] {truck, buldozer, excavator};
for (int i = 0; i < machine.length; i++) {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/core/basesyntax/Truck.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package core.basesyntax;

public class Truck extends Machine{
@Override
public void doWork() {
Expand Down

0 comments on commit 2970b99

Please sign in to comment.