Skip to content

solution#2597

Open
laubemarcin-sudo wants to merge 13 commits into
mate-academy:masterfrom
laubemarcin-sudo:master
Open

solution#2597
laubemarcin-sudo wants to merge 13 commits into
mate-academy:masterfrom
laubemarcin-sudo:master

Conversation

@laubemarcin-sudo

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

Your implementation correctly satisfies all functional requirements for this OOP inheritance task. The abstract class Machine with its abstract methods is properly implemented, all three subclasses (Truck, Bulldozer, Excavator) correctly extend Machine and override the required methods, and the polymorphism is properly demonstrated using a Machine array in MainApp. The only failing check run is a minor Checkstyle violation: MainApp.java is missing a trailing newline at the end of the file. This is a common formatting issue that linters will catch and is easily fixable. The redundant empty line comments mentioned in the file reviews are also style-related and fall under the same category. Since all core requirements pass and the code functions correctly, I've given my approval. Keep up the good work on the inheritance and polymorphism implementation!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

@@ -0,0 +1,13 @@
package core.basesyntax;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line after package declaration (line 2). The checklist specifies: 'Don't add redundant empty lines after class declaration or method signature.'

public void doWork() {
System.out.println("Excavator started its work.");
}

Copy link
Copy Markdown

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. Per checklist item #1, avoid empty lines after method signatures.

@@ -0,0 +1,13 @@
package core.basesyntax;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line after package declaration (line 2).

public void doWork() {
System.out.println("Excavator started its work.");
}

Copy link
Copy Markdown

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 (line 8).

@@ -0,0 +1,13 @@
package core.basesyntax;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line after package declaration (line 2).


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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line between abstract methods (line 5).

@@ -0,0 +1,13 @@
package core.basesyntax;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line after class declaration (line 2).

public void doWork() {
System.out.println("Excavator started its work.");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line after variable declarations (line 8).

}

@Override
public void stopWork() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line before for-loop (line 10).


public abstract class Machine {
public abstract void doWork();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line - remove line 5 between the two abstract method declarations (checklist item #1)

Comment on lines +4 to +5
public static void main(String[] args) {
Machine truck = new Truck(); //naprawa

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line found. Per checklist item #1, do not add empty lines between method declarations inside a class.

Comment on lines +7 to 8
Machine excavator = new Excavator();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line found inside class body. Per checklist item #1, empty lines after method declarations are not needed.

Comment on lines +4 to +5
public static void main(String[] args) {
Machine truck = new Truck(); //naprawa

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line found. Per checklist item #1, do not add empty lines between method declarations inside a class.

Comment on lines +7 to 8
Machine excavator = new Excavator();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line found inside class body. Per checklist item #1, empty lines after method declarations are not needed.

Comment on lines +5 to +6
Machine truck = new Truck(); //naprawa
Machine bulldozer = new Bulldozer();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line between abstract method declarations. Per checklist item #1, method declarations should be consecutive without empty lines.

Comment on lines 8 to +9

}
Machine[] machines = new Machine[]{truck, bulldozer, excavator};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line before array initialization. Per checklist item #1, avoid unnecessary empty lines within method bodies.

Comment on lines +10 to +11

for (Machine machine : machines) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line before for loop. Per checklist item #1, avoid unnecessary empty lines within method bodies.

@@ -0,0 +1,13 @@
package core.basesyntax;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line after package declaration. Checklist item #1 specifies to avoid empty lines after class declarations or method signatures.


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

Copy link
Copy Markdown

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. Checklist item #1 specifies to avoid empty lines after class declarations or method signatures.

@@ -0,0 +1,13 @@
package core.basesyntax;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line found. Per checklist item #1, avoid adding empty lines after package declaration.

public void doWork() {
System.out.println("Truck started its work.");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line between doWork() and stopWork() methods. Per checklist item #1, do not add empty lines after method declarations inside a class.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

I am approving your solution for this OOP inheritance task. Your implementation correctly demonstrates all required concepts: the abstract Machine class with abstract methods, proper inheritance with Truck, Bulldozer, and Excavator subclasses, correct method overriding with informative English messages, and polymorphism using a Machine array in MainApp. However, there are some style checklist violations that should be addressed for cleaner code: - Bulldozer.java - Remove the debug comment (leftover code) - Excavator.java - Remove redundant empty lines after class declaration and method signature - Machine.java - Remove the non-informative comment - MainApp.java - Clean up multiple empty lines between methods/braces and remove the //tak debug comment - Truck.java - Remove the redundant empty line between methods. These violations relate to [CHECKLIST ITEM #1] regarding proper empty line usage and [CHECKLIST ITEM #3] for only including informative comments. Keep up the good work on understanding OOP principles! Once you clean up these formatting issues, your code will be production-ready.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example


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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remove this debug comment - it appears to be leftover code that doesn't serve a purpose in the final implementation.

@@ -0,0 +1,13 @@
package core.basesyntax;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line after class declaration - violates checklist item #1

public void doWork() {
System.out.println("Excavator started its work.");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line after method signature - violates checklist item #1


public abstract class Machine {
public abstract void doWork();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remove this comment as it doesn't provide useful information about the code. Checklist requires informative comments/messages only.

Machine truck = new Truck(); //tak
Machine bulldozer = new Bulldozer();
Machine excavator = new Excavator();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line between method closing brace and next @OverRide annotation. Remove this empty line per checklist item #1.


public class MainApp {
public static void main(String[] args) {
Machine truck = new Truck(); //tak

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remove the //tak comment - it's unnecessary code that should be cleaned up.

Machine excavator = new Excavator();

Machine[] machines = new Machine[]{truck, bulldozer, excavator};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line before closing brace. Remove per checklist item #1.

Machine truck = new Truck(); //tak
Machine bulldozer = new Bulldozer();
Machine excavator = new Excavator();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line between method closing brace and next @OverRide annotation. Remove this empty line per checklist item #1.


public class MainApp {
public static void main(String[] args) {
Machine truck = new Truck(); //tak

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line between abstract method declarations. Remove per checklist item #1.

public void doWork() {
System.out.println("Truck started its work.");
}

Copy link
Copy Markdown

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 - violates checklist item #1 which states empty lines are not needed after class declaration or method signature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants