Skip to content

Commit

Permalink
replaced with the parent class in the main class and removed the empt…
Browse files Browse the repository at this point in the history
…y lines
  • Loading branch information
Nazar committed Jul 24, 2023
1 parent e4e88cb commit e269c77
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 14 deletions.
2 changes: 0 additions & 2 deletions src/main/java/core/basesyntax/Bulldozer.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package core.basesyntax;

public class Bulldozer extends Machine {
@Override
public void doWork() {
System.out.println("Bulldozer machine started its work");
}
@Override
public void stopWork() {

System.out.println("Bulldozer machine stopped its work");
}
}
3 changes: 0 additions & 3 deletions src/main/java/core/basesyntax/Excavator.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package core.basesyntax;

public class Excavator extends Machine {
@Override
public void doWork() {

System.out.println("Excavator machine started its work");
}
@Override
public void stopWork() {

System.out.println("Excavator machine stopped its work");
}
}
2 changes: 0 additions & 2 deletions src/main/java/core/basesyntax/Machine.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package core.basesyntax;

public abstract class Machine {
public abstract void doWork();
public abstract void stopWork();

}
7 changes: 3 additions & 4 deletions src/main/java/core/basesyntax/MainApp.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package core.basesyntax;

public class MainApp {
public static void main(String[] args) {
Truck truck = new Truck();
Bulldozer bulldozer = new Bulldozer();
Excavator excavator = new Excavator();
Machine truck = new Truck();
Machine bulldozer = new Bulldozer();
Machine excavator = new Excavator();
Machine[] machines = new Machine[]{truck, bulldozer, excavator};
for (Machine machine : machines) {
machine.doWork();
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/core/basesyntax/Truck.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package core.basesyntax;
public class Truck extends Machine {

@Override
public void doWork() {

System.out.println("Truck machine started its work");
}
@Override
public void stopWork() {

System.out.println("Truck machine stopped its work");
}
}

0 comments on commit e269c77

Please sign in to comment.