-
Notifications
You must be signed in to change notification settings - Fork 1.8k
added task solution #2435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
added task solution #2435
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Summary
Overall, your solution meets the core functional requirements: Machine
is abstract with the correct method signatures, each concrete class (Truck
, Bulldozer
, Excavator
) properly overrides doWork()
and stopWork()
, and MainApp
demonstrates polymorphism by iterating over a Machine[]
and invoking both methods. The code will compile and run correctly.
Minor style issues remain: redundant empty lines in multiple files, which the checklist asks to avoid. Please remove the extra blank lines at the noted spots:
- MainApp.java: remove the redundant empty line in the import/definition area.
- Bulldozer.java: line 2 (after
package
) and around line 8 (between methods). - Excavator.java: line 2 (after
package
) and around line 8 (betweendoWork()
and the next@Override
). Also ensure a space before{
inextends Machine {
. - Machine.java: remove the blank line before the class body and the blank line between
doWork()
andstopWork()
. - Truck.java: remove the redundant blank line after the package and the extra blank line between methods.
Optional: Keep message phrasing consistent across classes (e.g., all “started working”/“stopped working”). Nice work demonstrating polymorphism—just tidy up the formatting to fully align with the checklist.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
import core.basesyntax.models.Excavator; | ||
import core.basesyntax.models.Machine; | ||
import core.basesyntax.models.Truck; | ||
|
There was a problem hiding this comment.
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 here. This violates the checklist item: "Please don't add redundant empty lines to your code." Consider removing this blank line to keep the file formatting consistent with the project's style guide .
@@ -0,0 +1,13 @@ | |||
package core.basesyntax.models; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This violates checklist item "Please don't add redundant empty lines to your code." Consider removing the blank line here; there is no need for an empty line after the package declaration.
public void doWork() { | ||
System.out.println("Bulldozer started its work"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This violates checklist item "Please don't add redundant empty lines to your code." Consider removing this blank line between method implementations to keep the file concise and consistent with the project's style guidance.
@@ -0,0 +1,13 @@ | |||
package core.basesyntax.models; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This violates checklist item: "Please don't add redundant empty lines to your code." The blank line at line 2 (between the package declaration and the class declaration) is unnecessary — please remove it to match the requested style guidance (checklist) .
public void doWork() { | ||
System.out.println("Excavator started its work"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This violates checklist item: "Please don't add redundant empty lines to your code." The blank line at line 8 (between the end of doWork()
and the next @Override
) is redundant — please remove it to keep the code compact and consistent with the checklist guidance (checklist) .
@@ -0,0 +1,7 @@ | |||
package core.basesyntax.models; | |||
|
There was a problem hiding this comment.
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 empty line before 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." Consider removing this blank line so the package and class declaration are adjacent (no extra empty line) .
|
||
public abstract class Machine { | ||
public abstract void doWork(); | ||
|
There was a problem hiding this comment.
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 doWork()
and stopWork()
method signatures. 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 empty line so the two abstract methods appear consecutively without extra spacing .
@@ -0,0 +1,13 @@ | |||
package core.basesyntax.models; | |||
|
There was a problem hiding this comment.
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 empty line. This violates the checklist item: "Please don't add redundant empty lines to your code." Consider removing this blank line to keep the file tidy and consistent with the project's style guide.
public void doWork() { | ||
System.out.println("Truck started its work"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This blank line between methods is redundant. This violates the checklist item: "Please don't add redundant empty lines to your code." Remove the empty line between the end of doWork()
and the @Override
for stopWork()
to follow the style guidance.
No description provided.