generated from mate-academy/jv-homework-template
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24f8901
commit 00ae7d8
Showing
4 changed files
with
18 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# jv-oop | ||
|
||
- Create class core.basesyntax.Machine containing methods `public abstract void doWork()` and `public abstract void stopWork()`. | ||
- Create classes `core.basesyntax.Truck`, `core.basesyntax.Bulldozer`, `core.basesyntax.Excavator` that will inherit from `core.basesyntax.Machine`. | ||
- Create class Machine containing methods `public abstract void doWork()` and `public abstract void stopWork()`. | ||
- Create classes `Truck`, `Bulldozer`, `Excavator` that will inherit from `Machine`. | ||
- In those classes override `doWork()`, so it will print message that certain machine started its work. | ||
- Override `stopWork()` as well. It should print messages that certain machine stopped its work. | ||
- In `MainApp` class create `core.basesyntax.Machine` array with `core.basesyntax.Truck`, `core.basesyntax.Bulldozer` and `core.basesyntax.Excavator` and call methods `doWork()` and `stopWork()` in a loop. | ||
- In `MainApp` class create `Machine` array with `Truck`, `Bulldozer` and `Excavator` and call methods `doWork()` and `stopWork()` in a loop. | ||
|
||
#### [Try to avoid these common mistakes, while solving task](https://mate-academy.github.io/jv-program-common-mistakes/java-core/oop/oop) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
package core.basesyntax; | ||
|
||
public class Excavator extends Machine { | ||
|
||
public void doWork() { | ||
System.out.println("core.basesyntax.Excavator started its work"); | ||
System.out.println("Excavator started its work"); | ||
} | ||
|
||
public void stopWork() { | ||
System.out.println("core.basesyntax.Excavator stoped its work"); | ||
System.out.println("Excavator stoped its work"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
package core.basesyntax; | ||
|
||
public class Truck extends Machine { | ||
|
||
public void doWork() { | ||
|
||
System.out.println("Truck started its work"); | ||
} | ||
|
||
public void stopWork() { | ||
System.out.println("Truck stoped its work"); | ||
} | ||
|
||
} | ||
package core.basesyntax; | ||
|
||
public class Truck extends Machine { | ||
public void doWork() { | ||
System.out.println("Truck started its work"); | ||
} | ||
|
||
public void stopWork() { | ||
System.out.println("Truck stoped its work"); | ||
} | ||
} |