Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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;

Choose a reason for hiding this comment

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

This line is a redundant empty line after the package/before the class declaration. The checklist explicitly says: "Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature." Remove this extra blank line so the class declaration immediately follows the package statement. See checklist for guidance .

Choose a reason for hiding this comment

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

This violates checklist item #1: "Avoid redundant empty lines after class declarations and method signatures; keep formatting compact." Remove the redundant blank line after the package statement to keep formatting compact.

Choose a reason for hiding this comment

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

This violates checklist item #1: "Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature." Remove the empty line after the package declaration so the file begins directly with the class declaration.

public class Bulldozer extends Machine {

Choose a reason for hiding this comment

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

This blank line immediately follows the class declaration (public class Bulldozer extends Machine {). The checklist requires avoiding redundant empty lines after class declaration: "Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature." Remove this empty line so the first member/annotation appears directly after the class opening. See checklist .

Choose a reason for hiding this comment

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

This violates checklist item #1: "Avoid redundant empty lines after class declarations and method signatures; keep formatting compact." Remove the redundant blank line immediately after the class declaration so the @Override annotation follows the class header without an extra empty line.

@Override
public void doWork() {
System.out.println("Bulldozer started working");
}

Choose a reason for hiding this comment

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

This violates checklist item #1: "Avoid redundant empty lines after class declarations and method signatures; keep formatting compact." Remove the blank line between the first method block and the next @Override to avoid unnecessary vertical spacing between methods.

Choose a reason for hiding this comment

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

This violates checklist item #1: "Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature." Remove the empty line between the two methods (after } on line 7) so there is no extra blank line between doWork() and stopWork().

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

Choose a reason for hiding this comment

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

The console message here is grammatically incorrect: System.out.println("Bulldozer stopped to working");. This violates the checklist item: "Write informative messages in methods. - Use English only and make messages informative - The message should indicate what type of Machine is working right now Truck, Bulldozer or Excavator." Please change it to a clear English message that identifies the machine, for example: System.out.println("Bulldozer stopped working");. See the checklist for the exact requirement and this file for the current line .

Choose a reason for hiding this comment

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

This violates checklist item #2: "Messages printed by methods must be in English and informative, identifying the specific Machine type (Truck, Bulldozer, Excavator)." The string is ungrammatical — replace it with a correct message such as:

System.out.println("Bulldozer stopped working.");

This ensures the message is clear, grammatical, and matches the required format.

}
}
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;

Choose a reason for hiding this comment

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

There are redundant empty lines in this file (for example this blank line after the package). This goes against the style requirement: "Avoid redundant empty lines after class declarations and method signatures; keep formatting compact. [CHECKLIST ITEM #1]". Remove unnecessary blank lines so the file is more compact.

Choose a reason for hiding this comment

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

This violates checklist item #1: "Please don't add redundant empty lines to your code." Remove the blank line after the package declaration so the package statement is immediately followed by the class declaration.

public class Excavator extends Machine {

Choose a reason for hiding this comment

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

There is a redundant empty line immediately after the class declaration. This violates the checklist item: "Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature." Remove the blank line at this location so the first member (annotation/field/method) follows the class declaration without an extra empty line.

Choose a reason for hiding this comment

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

There is an unnecessary blank line inside the class body. This violates: "Avoid redundant empty lines after class declarations and method signatures; keep formatting compact. [CHECKLIST ITEM #1]". Remove this blank line to keep the class formatting compact.

@Override
public void doWork() {
System.out.println("Excavator started to working.");

Choose a reason for hiding this comment

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

This message is grammatically incorrect and violates the checklist requirement: "Write informative messages in methods. - Use English only and make messages informative - The message should indicate what type of Machine is working right now Truck, Bulldozer or Excavator." Change the text "Excavator started to working." to a clear English message, for example: "Excavator started working." so it correctly indicates the machine and action.

Choose a reason for hiding this comment

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

This print statement uses incorrect English. It violates the requirement: "Messages printed by methods must be in English and informative, identifying the specific Machine type (Truck, Bulldozer, Excavator). [CHECKLIST ITEM #2]".

Consider replacing the string with: "Excavator started working." so the message is grammatically correct and identifies the machine.

}

Choose a reason for hiding this comment

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

There is an unnecessary empty line between the end of the first method and the @Override of the next method. This also violates: "Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature." Remove the blank line here to keep methods compact and consistent with the checklist guidance.

Choose a reason for hiding this comment

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

Another redundant blank line inside the class. Please remove to satisfy: "Avoid redundant empty lines after class declarations and method signatures; keep formatting compact. [CHECKLIST ITEM #1]".

Choose a reason for hiding this comment

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

This violates checklist item #1: "Please don't add redundant empty lines to your code." Remove the unnecessary blank line between the doWork() and stopWork() methods to keep formatting compact and consistent.

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

Choose a reason for hiding this comment

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

This message is grammatically incorrect and violates the checklist requirement: "Write informative messages in methods. - Use English only and make messages informative - The message should indicate what type of Machine is working right now Truck, Bulldozer or Excavator." Change the text "Excavator stopped to working." to a clear English message, for example: "Excavator stopped working." so it correctly indicates the machine and action.

Choose a reason for hiding this comment

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

This print statement uses incorrect English. It violates the requirement: "Messages printed by methods must be in English and informative, identifying the specific Machine type (Truck, Bulldozer, Excavator). [CHECKLIST ITEM #2]".

Consider replacing the string with: "Excavator stopped working." so the message is grammatically correct and identifies the machine.

}
}
8 changes: 8 additions & 0 deletions src/main/java/core/basesyntax/Machine.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package core.basesyntax;

Choose a reason for hiding this comment

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

This file contains a redundant blank line immediately after the package statement. This violates checklist item #1: "Avoid redundant empty lines after class declarations and method signatures; keep formatting compact. [CHECKLIST ITEM #1]" Remove the empty line at line 2 so the package declaration is followed directly by the class declaration or imports (if any).

Choose a reason for hiding this comment

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

This violates checklist item #1: "Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature." Remove the redundant blank line after the package statement so the package is immediately followed by the class declaration.

public abstract class Machine {

Choose a reason for hiding this comment

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

There is an empty line right after the class declaration. This violates checklist item #1: "Avoid redundant empty lines after class declarations and method signatures; keep formatting compact. [CHECKLIST ITEM #1]" Remove the empty line at line 4 so the class body starts immediately after the declaration.

public abstract void doWork();

Choose a reason for hiding this comment

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

There is an unnecessary blank line between the two abstract method declarations. This violates checklist item #1: "Avoid redundant empty lines after class declarations and method signatures; keep formatting compact. [CHECKLIST ITEM #1]" Remove the empty line at line 6 so the method declarations are adjacent and the class remains compact.

Choose a reason for hiding this comment

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

This violates checklist item #1: "Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature." Remove the redundant blank line between the two method declarations so the methods follow each other without extra empty lines.

public abstract void stopWork();
}
12 changes: 12 additions & 0 deletions src/main/java/core/basesyntax/MainApp.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
package core.basesyntax;

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

for (Machine machine : machines) {
machine.doWork();
}

System.out.println("---All machines finished their tasks---");

for (Machine machine : machines) {
machine.stopWork();
}
Comment on lines 7 to 10

Choose a reason for hiding this comment

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

This does not follow the task instruction to call both methods per element. The description requires: "In the MainApp class create a Machine array with Truck, Bulldozer, and Excavator and call methods doWork() and stopWork() in a loop."

Currently you call doWork() for all machines in one loop and stopWork() for all machines in a separate loop (lines shown). Instead, iterate once and call both methods for the current Machine, for example:

for (Machine machine : machines) {
    machine.doWork();
    machine.stopWork();
}

This ensures each machine has both methods invoked in the same iteration, as required.

Comment on lines 7 to 10

Choose a reason for hiding this comment

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

The current code iterates twice: one loop calls doWork() and later another loop calls stopWork(). This violates the task requirement: "In the MainApp class create a Machine array with Truck, Bulldozer, and Excavator and call methods doWork() and stopWork() in a loop." Quote from the task description: "In the MainApp class create a Machine array with Truck, Bulldozer, and Excavator and call methods doWork() and stopWork() in a loop." You should instead use a single loop that, for each Machine m, calls m.doWork(); followed immediately by m.stopWork();. After that single loop you can print the "All machines finished" message. Concrete suggestion: replace the two separate for loops with:

for (Machine m : machines) {
    m.doWork();
    m.stopWork();
}
System.out.println("---All machines finished their tasks---");

This change ensures the behavior required by the task description and preserves polymorphic usage of Machine references.

}
}
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;

Choose a reason for hiding this comment

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

This violates the checklist item: "Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature." Remove the unnecessary blank line after the package declaration. It's redundant and not needed (line 2).

Choose a reason for hiding this comment

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

This violates checklist item #1: "Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature." Remove the blank line after the package statement so the package is immediately followed by the class declaration.

public class Truck extends Machine {

Choose a reason for hiding this comment

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

This violates the checklist item: "Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature." Remove the redundant blank line immediately after the class declaration (line 4).

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

Comment on lines 2 to 8

Choose a reason for hiding this comment

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

This violates checklist item #1: "Please don't add redundant empty lines to your code." Remove the blank lines after the package declaration and after the class/method signatures to keep the formatting compact (specifically remove the empty lines at lines 2, 4, and 9).

Choose a reason for hiding this comment

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

This violates checklist item #1: "Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature." Remove the blank line between the two method blocks so the methods are adjacent without an extra empty line.

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