solution#2597
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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
| @@ -0,0 +1,13 @@ | |||
| package core.basesyntax; | |||
|
|
|||
There was a problem hiding this comment.
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."); | ||
| } | ||
|
|
There was a problem hiding this comment.
Redundant empty line between methods. Per checklist item #1, avoid empty lines after method signatures.
| @@ -0,0 +1,13 @@ | |||
| package core.basesyntax; | |||
|
|
|||
There was a problem hiding this comment.
Redundant empty line after package declaration (line 2).
| public void doWork() { | ||
| System.out.println("Excavator started its work."); | ||
| } | ||
|
|
There was a problem hiding this comment.
Redundant empty line between methods (line 8).
| @@ -0,0 +1,13 @@ | |||
| package core.basesyntax; | |||
|
|
|||
There was a problem hiding this comment.
Redundant empty line after package declaration (line 2).
|
|
||
| public class Excavator extends Machine { | ||
| @Override | ||
| public void doWork() { |
There was a problem hiding this comment.
Redundant empty line between abstract methods (line 5).
| @@ -0,0 +1,13 @@ | |||
| package core.basesyntax; | |||
|
|
|||
There was a problem hiding this comment.
Redundant empty line after class declaration (line 2).
| public void doWork() { | ||
| System.out.println("Excavator started its work."); | ||
| } | ||
|
|
There was a problem hiding this comment.
Redundant empty line after variable declarations (line 8).
| } | ||
|
|
||
| @Override | ||
| public void stopWork() { |
There was a problem hiding this comment.
Redundant empty line before for-loop (line 10).
|
|
||
| public abstract class Machine { | ||
| public abstract void doWork(); | ||
|
|
There was a problem hiding this comment.
Redundant empty line - remove line 5 between the two abstract method declarations (checklist item #1)
| public static void main(String[] args) { | ||
| Machine truck = new Truck(); //naprawa |
There was a problem hiding this comment.
Redundant empty line found. Per checklist item #1, do not add empty lines between method declarations inside a class.
| Machine excavator = new Excavator(); | ||
|
|
There was a problem hiding this comment.
Redundant empty line found inside class body. Per checklist item #1, empty lines after method declarations are not needed.
| public static void main(String[] args) { | ||
| Machine truck = new Truck(); //naprawa |
There was a problem hiding this comment.
Redundant empty line found. Per checklist item #1, do not add empty lines between method declarations inside a class.
| Machine excavator = new Excavator(); | ||
|
|
There was a problem hiding this comment.
Redundant empty line found inside class body. Per checklist item #1, empty lines after method declarations are not needed.
| Machine truck = new Truck(); //naprawa | ||
| Machine bulldozer = new Bulldozer(); |
There was a problem hiding this comment.
Redundant empty line between abstract method declarations. Per checklist item #1, method declarations should be consecutive without empty lines.
|
|
||
| } | ||
| Machine[] machines = new Machine[]{truck, bulldozer, excavator}; |
There was a problem hiding this comment.
Redundant empty line before array initialization. Per checklist item #1, avoid unnecessary empty lines within method bodies.
|
|
||
| for (Machine machine : machines) { |
There was a problem hiding this comment.
Redundant empty line before for loop. Per checklist item #1, avoid unnecessary empty lines within method bodies.
| @@ -0,0 +1,13 @@ | |||
| package core.basesyntax; | |||
|
|
|||
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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; | |||
|
|
|||
There was a problem hiding this comment.
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."); | ||
| } | ||
|
|
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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
|
|
||
| public class Bulldozer extends Machine { | ||
| @Override | ||
| public void doWork() { |
There was a problem hiding this comment.
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; | |||
|
|
|||
There was a problem hiding this comment.
Redundant empty line after class declaration - violates checklist item #1
| public void doWork() { | ||
| System.out.println("Excavator started its work."); | ||
| } | ||
|
|
There was a problem hiding this comment.
Redundant empty line after method signature - violates checklist item #1
|
|
||
| public abstract class Machine { | ||
| public abstract void doWork(); | ||
|
|
There was a problem hiding this comment.
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(); | ||
|
|
|
|
||
| public class MainApp { | ||
| public static void main(String[] args) { | ||
| Machine truck = new Truck(); //tak |
There was a problem hiding this comment.
Remove the //tak comment - it's unnecessary code that should be cleaned up.
| Machine excavator = new Excavator(); | ||
|
|
||
| Machine[] machines = new Machine[]{truck, bulldozer, excavator}; | ||
|
|
There was a problem hiding this comment.
Redundant empty line before closing brace. Remove per checklist item #1.
| Machine truck = new Truck(); //tak | ||
| Machine bulldozer = new Bulldozer(); | ||
| Machine excavator = new Excavator(); | ||
|
|
|
|
||
| public class MainApp { | ||
| public static void main(String[] args) { | ||
| Machine truck = new Truck(); //tak |
There was a problem hiding this comment.
Redundant empty line between abstract method declarations. Remove per checklist item #1.
| public void doWork() { | ||
| System.out.println("Truck started its work."); | ||
| } | ||
|
|
There was a problem hiding this comment.
Redundant empty line between methods - violates checklist item #1 which states empty lines are not needed after class declaration or method signature
No description provided.