Skip to content

Implement OOP basic task#2612

Open
kbukatiuk wants to merge 1 commit into
mate-academy:masterfrom
kbukatiuk:master
Open

Implement OOP basic task#2612
kbukatiuk wants to merge 1 commit into
mate-academy:masterfrom
kbukatiuk:master

Conversation

@kbukatiuk

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 solution correctly implements all core requirements: Machine is abstract with doWork() and stopWork(), Truck, Bulldozer, and Excavator extend it, and MainApp uses a Machine[] and loops to call both methods polymorphically. There are no functional or syntax issues, and the program’s behavior matches the task description, so I am approving your work. The remaining issues are minor formatting and wording improvements: you have some redundant empty lines after package statements, class declarations, and between method signatures ([CHECKLIST ITEM #1]), and your printed messages could be made more grammatical and informative, e.g. "Truck started working" / "Truck stopped working" instead of "Truck is start/stop working" ([CHECKLIST ITEM #2]). These are easy fixes and will likely be flagged by style checks, so I recommend cleaning them up in your next iteration for more polished code. Overall, you’ve demonstrated correct use of abstraction and polymorphism—nice work on meeting the core OOP goals of the task.


✨ 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,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.

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 and again between methods.

public class Bulldozer extends Machine {
@Override
public void doWork() {
System.out.println("Bulldozer is start working");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The message is in English and identifies the machine type, but it’s not very informative/grammatically correct ("Bulldozer started working" or "Bulldozer started its work" would better satisfy checklist item #2). Consider rephrasing.


@Override
public void stopWork() {
System.out.println("Bulldozer is stop working");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Similar to doWork, this stop message is understandable but not very informative/grammatically correct. To better meet checklist item #2, consider a clearer phrasing like "Bulldozer stopped working".

@@ -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.

This violates checklist item #1: there is a redundant empty line after the package line and between method declarations.

public class Bulldozer extends Machine {
@Override
public void doWork() {
System.out.println("Bulldozer is start working");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The message should be informative and grammatically correct per checklist item #2; a clearer variant like "Excavator started working" would be preferable.


@Override
public void stopWork() {
System.out.println("Bulldozer is stop working");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Similarly, "Excavator stopped working" would make this message more informative and natural to fully satisfy checklist item #2.


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.

Checklist item #1 advises not adding redundant empty lines after class declaration or between method signatures; this blank line between the abstract methods is not needed.

public class Excavator extends Machine {
@Override
public void doWork() {
System.out.println("Excavator is start working");

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: Write informative messages in methods. - Use English only and make messages informative. The message is understandable but grammatically incorrect and not very descriptive; consider something like Bulldozer started working or Bulldozer started its work to clearly indicate the machine and action.


@Override
public void stopWork() {
System.out.println("Excavator is stop working");

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: Write informative messages in methods. - Use English only and make messages informative. Similar to doWork, this stop message should be a clear English sentence, e.g. Bulldozer stopped working.


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.

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 empty line between the abstract methods in this simple class; you can place them consecutively as in the improved example.

public class Excavator extends Machine {
@Override
public void doWork() {
System.out.println("Excavator is start working");

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: Write informative messages in methods. - Use English only and make messages informative. The start-work message for Excavator should be grammatically correct and descriptive, e.g. Excavator started working.


@Override
public void stopWork() {
System.out.println("Excavator is stop working");

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: Write informative messages in methods. - Use English only and make messages informative. Adjust the stop-work message to a clear sentence like Excavator stopped working.

@@ -0,0 +1,8 @@
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. There is an unnecessary blank line after the package and before the class declaration.

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

public abstract 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.

This violates checklist item: Write informative messages in methods. The message is English and mentions Bulldozer, but the phrase is start working is not grammatically correct and could be made more informative (e.g. Bulldozer started working).


public abstract 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.

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.

@@ -0,0 +1,8 @@
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. There is an unnecessary blank line after the package statement.

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

public abstract 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.

This violates checklist item: Write informative messages in methods. The message mentions Excavator but is start working is not proper English; improve the phrasing to be clearly informative.


public abstract 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.

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 doWork and stopWork.

@@ -0,0 +1,8 @@
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. There is a redundant blank line after the package statement.


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.

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 a redundant blank line between the two abstract method declarations.

public class MainApp {

public static void main(String[] args) {
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.

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 empty line between the two abstract method declarations that the checklist asks you to avoid.

@@ -1,5 +1,15 @@
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. There is an extra empty line after the package declaration that should be removed.

Machine[] machines = {
new Truck(),
new Bulldozer(),
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 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 after the class declaration that should be removed.

@@ -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.

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 after the package statement.

public class Truck extends Machine {
@Override
public void doWork() {
System.out.println("Truck is start working");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item Write informative messages in methods expects clear English messages. Here, Truck is start working is grammatically incorrect; consider something like Truck started working or Truck started its work to make it more informative and correct.

public void doWork() {
System.out.println("Truck is start working");
}

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 extra blank line between methods.


@Override
public void stopWork() {
System.out.println("Truck is stop working");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Similarly to doWork, Truck is stop working is not proper English and weakens informativeness for checklist item Write informative messages in methods. A clearer message would be Truck stopped working.

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