Skip to content

Commit

Permalink
created classes, overridden abstract methods, and created an array of…
Browse files Browse the repository at this point in the history
… class dataÑÐ
  • Loading branch information
FireFalcons committed Aug 22, 2024
1 parent 0c81ce0 commit 47e3b25
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/main/java/core/basesyntax/Bulldozer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package core.basesyntax;

public class Bulldozer extends Machine{

@Override
public void doWork() {
System.out.println("the bulldozer started it`s work");
}

@Override
public void stopWork() {
System.out.println("the bulldozer stopped it`s work");
}
}
15 changes: 15 additions & 0 deletions src/main/java/core/basesyntax/Excavator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package core.basesyntax;

public class Excavator extends Machine {

@Override
public void doWork() {
System.out.println("the excavator started it`s work");

}

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

public abstract class Machine {
public abstract void doWork();
public abstract void stopWork();
}
12 changes: 11 additions & 1 deletion src/main/java/core/basesyntax/MainApp.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
package core.basesyntax;

public class MainApp {
public static void main(String[] args) {
Machine truck = new Truck();
Machine bulldozer = new Bulldozer();
Machine excavator = new Excavator();
Machine[] machine = {truck, bulldozer, excavator};

for (Machine m : machine) {
m.doWork();
m.stopWork();
System.out.println();
}
}
}
14 changes: 14 additions & 0 deletions src/main/java/core/basesyntax/Truck.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package core.basesyntax;

public class Truck extends Machine{

@Override
public void doWork() {
System.out.println("the truck started it`s work");
}

@Override
public void stopWork() {
System.out.println("the truck stopped it`s work");
}
}

0 comments on commit 47e3b25

Please sign in to comment.