Skip to content

Commit

Permalink
Create new classes, second
Browse files Browse the repository at this point in the history
  • Loading branch information
dzxd16 committed Dec 8, 2024
1 parent 8209df2 commit 65736ea
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/main/java/core/basesyntax/Bulldozer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

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

@Override
public void stopWork() {
public void stopWork(){
System.out.println("Bulldozer stopped working");
}
}
4 changes: 2 additions & 2 deletions src/main/java/core/basesyntax/Excavator.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

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

@Override
public void stopWork() {
public void stopWork(){
System.out.println("Excavator stopped working");
}
}
3 changes: 3 additions & 0 deletions src/main/java/core/basesyntax/Machine.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package core.basesyntax;

public abstract class Machine {

public abstract void doWork();

public abstract void stopWork();

}
14 changes: 7 additions & 7 deletions src/main/java/core/basesyntax/Main.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package core.basesyntax;

public class Main {
public static void main(String[] args) {
public static void main(String[] args){

Machine[] machines = {new Truck(), new Bulldozer(), new Excavator()};
for( Machine mash : machines ) {
mash.doWork();
mash.stopWork();
Machine[] machines = {new Truck(), new Bulldozer(), new Excavator()};
for ( Machine mash : machines ) {
mash.doWork();
mash.stopWork();
}
}

}
}
}
4 changes: 2 additions & 2 deletions src/main/java/core/basesyntax/Truck.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

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

@Override
public void stopWork() {
public void stopWork(){
System.out.println("Truck stopped working");
}
}

0 comments on commit 65736ea

Please sign in to comment.