Skip to content
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

solved task #2173

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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("Bulldozer is doing its work.");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message should be more informative and indicate the type of Machine that is working. Consider specifying that a Bulldozer is operating.

}

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly to the doWork method, the message in stopWork should be more informative. Specify that a Bulldozer has stopped working.

}
}

14 changes: 14 additions & 0 deletions src/main/java/core/basesyntax/Excavator.java
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 is doing its work.");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message should be more informative and indicate that it is an Excavator that is working. For example: 'Excavator started its engine and is digging.'

}

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stop message should also be more informative. Consider something like: 'Excavator has been turned off and can no longer dig.'

}
}

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();
}
13 changes: 12 additions & 1 deletion src/main/java/core/basesyntax/MainApp.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
package core.basesyntax;

public class MainApp {

public static void main(String[] args) {
String[] mashine = new String[] {"Truck", "Bulldozer", "Excavator"};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name mashine contains a typo and is not used in the code. If it's not needed, it should be removed to keep the code clean.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The array mashine is declared but never used in the code. If this array is not needed, it should be removed to keep the code clean and avoid unnecessary declarations.

Machine truck = new Truck();
Machine bulldozer = new Bulldozer();
Machine excavator = new Excavator();
Comment on lines +6 to +8

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job using abstract references for Machine types. This allows for polymorphism in the code.

truck.doWork();
bulldozer.doWork();
excavator.doWork();
truck.stopWork();
bulldozer.stopWork();
excavator.stopWork();
Comment on lines +9 to +14

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure that the messages in the doWork() and stopWork() methods are informative and indicate what type of Machine is working or stopping work.

}
}
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("Truck is doing its work.");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message 'Truck is doing its work.' is not very informative. It would be better to specify what kind of work the Truck is doing, to make the message more informative as per the checklist.

}

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, the message 'Truck has stopped working.' could be more descriptive. Consider specifying what indicates that the Truck has stopped its work.

}
}

Loading