Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
13 changes: 13 additions & 0 deletions src/main/java/core/basesyntax/Bulldozer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package core.basesyntax;

Choose a reason for hiding this comment

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

Missing required project elements: the abstract Machine class, and the other concrete classes (Truck and Excavator), plus the MainApp entry point are not present in the submitted files. This violates checklist item 1.1: "Create an abstract class named Machine that declares two abstract methods: - public abstract void doWork(); - public abstract void stopWork();" and checklist item 1.2: "Create three concrete classes: Truck, Bulldozer, and Excavator that inherit from Machine." It also violates checklist item 1.5: "Create a MainApp class with a main method that: - Creates an array (or collection) of Machine references containing instances of Truck, Bulldozer, and Excavator. - Iterates over the array and calls doWork() and stopWork() for each element." Additionally, checklist item 3.2 states: "In MainApp, create instances with abstract references, e.g., Machine m = new Truck(); and store them in a Machine[] (or similar). Avoid using concrete-type references like Truck t = new Truck(); when not necessary." Please add these missing files so I can fully verify the task requirements and polymorphism behavior.


Choose a reason for hiding this comment

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

This file has a redundant blank line immediately after the package declaration. Please remove it to comply with the checklist item: "Please don't add redundant empty lines to your code."

public class Bulldozer extends Machine {
@Override
public void doWork() {

Choose a reason for hiding this comment

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

Suggestion: add the @OverRide annotation above doWork(). While not strictly required by the checklist, it makes the overriding intent explicit and enables compiler checks. Example:

@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.

Redundant empty line between methods. Please remove it to follow the style requirement: "Do not add redundant empty lines after class declarations or method signatures." (checklist item 4.1).

Choose a reason for hiding this comment

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

This blank line between the two method blocks is redundant. Remove it to comply with the checklist item: "Please don't add redundant empty lines to your code."

@Override
public void stopWork() {

Choose a reason for hiding this comment

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

Suggestion: add the @OverRide annotation above stopWork() as well, for the same reasons as above.

System.out.println("Bulldozer stopped working");
}
}
13 changes: 13 additions & 0 deletions src/main/java/core/basesyntax/Excavator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package core.basesyntax;

public class Excavator extends Machine {
@Override
public void doWork() {
System.out.println("Excavator started working");
}

Choose a reason for hiding this comment

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

Redundant empty line between methods. Remove this blank line so there are no unnecessary empty lines after method bodies/signatures. Quote of violated checklist item: "Please don't add redundant empty lines to your code."

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." Remove the blank line at line 8 — the empty line between the end of doWork() and the @Override for stopWork() is redundant. Also keep in mind the related guideline: "Do not include redundant empty lines immediately after class declarations or method signatures."

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

public abstract class Machine {

Choose a reason for hiding this comment

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

The project currently lacks the required concrete subclasses and the main application. This violates the checklist item: "Create three concrete classes: Truck, Bulldozer, and Excavator that inherit from Machine (extend Machine)." and also violates: "Create a MainApp class with a main method that: - Creates an array (or collection) of Machine references containing instances of Truck, Bulldozer, and Excavator. - Iterates over the array and calls doWork() and stopWork() for each element." Please add Truck, Bulldozer, Excavator classes (each extending Machine and overriding the methods with informative messages) and a MainApp with a main method that stores them in a Machine[] and invokes doWork() / stopWork().

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 a redundant blank line between the two abstract method declarations. This violates the style checklist: "Please don't add redundant empty lines to your code." Remove the blank line so the two method declarations are adjacent (no extra empty line after the method signature).

Choose a reason for hiding this comment

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

This file violates the checklist item "Please don't add redundant empty lines to your code." There is a redundant empty line between the two abstract method declarations. Remove the blank line so public abstract void doWork(); and public abstract void stopWork(); are on adjacent lines.

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

public class MainApp {

public static void main(String[] args) {
// All executable code goes inside this method
Machine[] machines = {new Truck(), new Bulldozer(), new Excavator()};

Choose a reason for hiding this comment

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

This line constructs the array using new Truck() and new Excavator() but those classes (and the abstract Machine type if not present) appear not to be provided. Without the abstract Machine class and the concrete Truck and Excavator classes this file will not compile. This violates the following checklist items (quoted exactly):

  • "Create an abstract class named Machine that declares two abstract methods: - public abstract void doWork(); - public abstract void stopWork();" (checklist item 1.1)
  • "Create three concrete classes: Truck, Bulldozer, and Excavator that inherit from Machine." (checklist item 1.2)
  • "Create a MainApp class with a main method that: - Creates an array (or collection) of Machine references containing instances of Truck, Bulldozer, and Excavator. - Iterates over the array and calls doWork() and stopWork() for each element." (checklist item 1.5)
  • "In MainApp, create instances with abstract references, e.g., Machine m = new Truck(); and store them in a Machine[] (or similar). Avoid using concrete-type references like Truck t = new Truck(); when not necessary." (checklist item 3.2)

Please add the missing Machine, Truck, and Excavator classes (implement doWork()/stopWork() in each) so the project can compile and I can verify the rest of the checklist.

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

Choose a reason for hiding this comment

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

Missing required project elements. The project must include an abstract Machine class and the other classes and entry point required by the task. This violates checklist item 1.1: "Create an abstract class named Machine that declares two abstract methods: - public abstract void doWork(); - public abstract void stopWork();" and checklist item 1.2: "Create three concrete classes: Truck, Bulldozer, and Excavator that inherit from Machine." It also violates checklist item 1.5: "Create a MainApp class with a main method that: - Creates an array (or collection) of Machine references containing instances of Truck, Bulldozer, and Excavator. - Iterates over the array and calls doWork() and stopWork() for each element." Additionally, checklist item 3.2 requires: "In MainApp, create instances with abstract references, e.g., Machine m = new Truck(); and store them in a Machine[] (or similar). Avoid using concrete-type references like Truck t = new Truck(); when not necessary." Please add Machine, Excavator, and MainApp files so the full task can be verified.


Choose a reason for hiding this comment

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

Redundant empty line immediately after the package declaration. Please remove it to follow the style requirement: "Do not add redundant empty lines after class declarations or method signatures." (checklist item 4.1).

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." Remove the redundant empty line at line 2 (blank line between the package declaration and the class declaration).

public class Truck extends Machine {
@Override
public void doWork() {

Choose a reason for hiding this comment

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

Suggestion: add the @Override annotation above doWork() to make the overriding explicit and enable compiler checks. Example:

@Override
public void doWork() { ... }

System.out.println("Truck started working");
}

Choose a reason for hiding this comment

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

Redundant empty line between methods. Please remove it to follow the style requirement: "Do not add redundant empty lines after class declarations or method signatures." (checklist item 4.1).

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." Remove the redundant empty line at line 8 (blank line between the end of doWork() and the @Override for stopWork()).

@Override
public void stopWork() {

Choose a reason for hiding this comment

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

Suggestion: add the @Override annotation above stopWork() as well. This is recommended for clarity and compile-time verification.

System.out.println("Truck stopped working");
}
}