-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Done homework #2504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Done homework #2504
Changes from 3 commits
950bcb6
6fefdce
b214cce
3daf0cb
e47b1d2
b775d39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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("Bulldozer started work"); | ||
| } | ||
|
|
||
| @Override | ||
| public void stopWork() { | ||
| System.out.println("Bulldozer stopped work"); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package core.basesyntax; | ||
|
|
||
| public class Excavator extends Machine { | ||
|
|
||
| @Override | ||
| public void doWork() { | ||
| System.out.println("Excavator started work"); | ||
| } | ||
|
|
||
| @Override | ||
| public void stopWork() { | ||
| System.out.println("Excavator stopped work"); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package core.basesyntax; | ||
|
|
||
| public abstract class Machine { | ||
|
|
||
|
||
| public abstract void doWork(); | ||
|
|
||
| public abstract void stopWork(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,22 @@ | ||
| package core.basesyntax; | ||
|
|
||
| public class MainApp { | ||
| public static void main(String[] args) { | ||
| Machine[] machines = new Machine[7]; | ||
|
|
||
| machines[0] = new Truck(); | ||
| machines[1] = new Bulldozer(); | ||
| machines[2] = new Excavator(); | ||
| machines[3] = new Excavator(); | ||
| machines[4] = new Truck(); | ||
| machines[5] = new Bulldozer(); | ||
| machines[6] = new Truck(); | ||
|
|
||
| for (int i = 0; i < machines.length; i++) { | ||
| machines[i].doWork(); | ||
| machines[i].stopWork(); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| } |
| 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("Truck started work"); | ||
| } | ||
|
|
||
| @Override | ||
| public void stopWork() { | ||
| System.out.println("Truck stopped work"); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This empty line is redundant. This violates checklist item #1: 'Please don't add redundant empty lines to your code. We don't need them after class declaration...'.