Skip to content

Abstract class and 3 inherited classes. Loop in main#2604

Open
Moskerito wants to merge 1 commit into
mate-academy:masterfrom
Moskerito:feature/jv-oop
Open

Abstract class and 3 inherited classes. Loop in main#2604
Moskerito wants to merge 1 commit into
mate-academy:masterfrom
Moskerito:feature/jv-oop

Conversation

@Moskerito

Copy link
Copy Markdown

Added abstract class and 3 inherited classes with methods. Modified main class to call these methods in a loop

@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 solution is approved because all core functional requirements are correctly implemented: Machine is an abstract class with public abstract void doWork() and public abstract void stopWork(), Truck, Bulldozer, and Excavator extend it and override these methods with clear English messages, and MainApp uses a Machine[] and polymorphism to call these methods in a loop. The design and access modifiers are appropriate, and there are no functional issues or violations that would block task completion.

The only remaining issues are minor style points about redundant empty lines, for example: in Bulldozer.java and Truck.java you have extra blank lines after the package declaration, immediately after the class declaration, and between methods, and in Excavator.java and MainApp.java there are unnecessary blank lines inside the class/method bodies. These relate to [CHECKLIST ITEM #1], which asks you to avoid redundant empty lines after class declarations or method signatures. To polish your code, remove those extra blank lines so that there is no blank line right after class Name { or directly between consecutive method signatures/bodies, and keep the body compact but readable.

Functionally you did a solid job: your messages are informative and clearly identify each machine, and you are correctly using the abstract type Machine for variables and arrays. Keep focusing on these small formatting details, as they will help you meet automated style checks and maintain clean, professional code in future tasks.


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

Footnotes

  1. Rate AI review example

@@ -0,0 +1,14 @@
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.

This violates checklist item Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature. You have an extra blank line between the package and class declaration and also inside the class body that should be removed.

package core.basesyntax;

public class Bulldozer extends Machine {

Copy link
Copy Markdown

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. We don't need them after class declaration or method signature. There is an unnecessary blank line right after the class declaration.

public void doWork() {
System.out.println("A bulldozer 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.

This violates checklist item Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature. There is an unnecessary blank line between methods inside the class.

@@ -0,0 +1,14 @@
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.

This violates checklist item Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature. You have an extra blank line between the package and class declaration and also inside the class body that should be removed.

package core.basesyntax;

public class Bulldozer extends Machine {

Copy link
Copy Markdown

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. We don't need them after class declaration or method signature. There is an unnecessary blank line right after the class declaration.

package core.basesyntax;

public class Excavator extends Machine {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item #1: Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature. There is an extra blank line between the class declaration and the first method; remove it to comply with the style requirement.

Machine truck = new Truck();
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.

This violates checklist item #1: Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature. There is an extra empty line inside main between variable declarations and array creation that you can remove.

@@ -0,0 +1,14 @@
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.

This violates checklist item #1: Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature. There is an unnecessary blank line after the package declaration that should be removed.

package core.basesyntax;

public class Truck extends Machine {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item #1: Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature. There is an extra blank line right after the class declaration.

public void doWork() {
System.out.println("A 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.

This violates checklist item #1: Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature. There is an unnecessary blank line between the two methods inside the class.

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