feat: Create abstract Machine class and machine implementations#2615
feat: Create abstract Machine class and machine implementations#2615Vladyslav881 wants to merge 1 commit into
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation successfully fulfills all core functional requirements: the abstract Machine class with abstract methods, proper inheritance hierarchy (Truck, Bulldozer, Excavator extending Machine), method overrides with descriptive English messages, and polymorphic array usage in MainApp. All tests pass and the code works correctly. While there are minor style issues noted—redundant empty lines after class declarations and method signatures in several files, and the Machine class using default access modifier instead of explicit public—these are formatting and best-practice concerns rather than functional blockers. The checklist items for these issues (#12, #14) are important for code quality, but since your solution is functionally correct and these issues don't prevent task completion or break functionality, the submission is approved. Consider addressing the whitespace formatting before final submission to fully comply with the style checklist.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| @Override | ||
| public void doWork() { | ||
| System.out.println("Bulldozer started working"); | ||
| } |
There was a problem hiding this comment.
Redundant empty line after method signature. The checklist specifies: 'No redundant empty lines after class declaration or method signature.'
| public void doWork() { | ||
| System.out.println("Bulldozer started working"); | ||
| } | ||
|
|
There was a problem hiding this comment.
Redundant empty line between methods. The checklist specifies: 'No redundant empty lines after class declaration or method signature.'
| @Override | ||
| public void doWork() { | ||
| System.out.println("Bulldozer started working"); | ||
| } |
There was a problem hiding this comment.
Redundant empty line after method signature. The checklist specifies: 'No redundant empty lines after class declaration or method signature.'
| public void doWork() { | ||
| System.out.println("Bulldozer started working"); | ||
| } | ||
|
|
There was a problem hiding this comment.
Redundant empty line between methods. The checklist specifies: 'No redundant empty lines after class declaration or method signature.'
|
|
||
| public class Bulldozer extends Machine { | ||
| @Override | ||
| public void doWork() { |
There was a problem hiding this comment.
Redundant empty line between methods. The checklist specifies: 'No redundant empty lines after class declaration or method signature.'
| @@ -1,5 +1,15 @@ | |||
| package core.basesyntax; | |||
|
|
|||
| public class MainApp { | |||
There was a problem hiding this comment.
The Machine class uses default (package-private) access modifier. Per checklist item #14, class elements should use appropriate access modifiers. Since this class is designed to be extended and used as a base for polymorphism, it should be declared as public for proper encapsulation.
| @@ -1,5 +1,15 @@ | |||
| package core.basesyntax; | |||
|
|
|||
There was a problem hiding this comment.
Redundant empty line after class declaration violates checklist item #12 - avoid empty lines after class declarations.
| Machine[] machines = { | ||
| new Truck(), | ||
| new Bulldozer(), | ||
| new Excavator() |
There was a problem hiding this comment.
Redundant empty line between methods violates checklist item #12 - avoid empty lines after method signatures.
| @@ -0,0 +1,13 @@ | |||
| package core.basesyntax; | |||
|
|
|||
There was a problem hiding this comment.
Redundant empty line after class declaration. Per checklist item #12: 'Don't add redundant empty lines after class declaration or method signature.'
| public void doWork() { | ||
| System.out.println("Truck started working"); | ||
| } | ||
|
|
There was a problem hiding this comment.
Redundant empty line between methods. Per checklist item #12: 'Don't add redundant empty lines after class declaration or method signature.'
Created Machine hierarchy with Truck, Bulldozer, and Excavator implementations.
Implemented polymorphism using Machine references.