Skip to content

OOP-Basic#2506

Open
444Sergey wants to merge 3 commits intomate-academy:masterfrom
444Sergey:jv-oop
Open

OOP-Basic#2506
444Sergey wants to merge 3 commits intomate-academy:masterfrom
444Sergey:jv-oop

Conversation

@444Sergey
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Hi! Your solution has a great structure, and you've correctly used inheritance and polymorphism. However, I am requesting a few changes to meet all the requirements.

The main issue is that the output messages in your Truck, Bulldozer, and Excavator classes are not informative enough. According to the task, the messages should be clear, full sentences describing the action. For example, instead of "doWork truck", the message should be "Truck started its work.". This violates a core requirement of the task [CHECKLIST ITEM #2]. Please update the doWork() and stopWork() methods in each subclass to print more descriptive messages.

Additionally, the name field in the Machine class and the corresponding setName() calls in MainApp are not used. You can remove this unnecessary code to simplify your solution. Keep up the great work!


✨ 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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment on lines 4 to 12
private String name;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

Choose a reason for hiding this comment

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

The name field and its getter/setter methods are not required by the task description. The subclasses don't use this field to print their messages, making this code unnecessary for the current task. It's good practice to only add code that is needed to fulfill the requirements.

Comment on lines 6 to 12
truck.setName("truck");

Machine bulldozer = new Bulldozer();
bulldozer.setName("bulldozer");

Machine excavator = new Excavator();
excavator.setName("excavator");

Choose a reason for hiding this comment

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

These calls to setName() are not required by the task, and the name property is never used to generate the output messages. The messages are hardcoded in the doWork() and stopWork() methods of each specific machine class. You can remove the name field from the Machine class and these setName() calls to simplify the solution.

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

Choose a reason for hiding this comment

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

This violates checklist item #2: 'Write informative messages in methods.' The message should clearly state that the excavator has started its work, for example: Excavator started its work.


@Override
public void stopWork() {
System.out.println("stopWork excavator");

Choose a reason for hiding this comment

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

This violates checklist item #2: 'Write informative messages in methods.' The message should clearly state that the excavator has stopped working, for example: Excavator stopped working.

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

Choose a reason for hiding this comment

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

This violates checklist item #2: 'Write informative messages in methods'. The message should be a full sentence that clearly states the machine has started its work, for example, Bulldozer started its work.


@Override
public void stopWork() {
System.out.println("stopWork bulldozer");

Choose a reason for hiding this comment

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

This violates checklist item #2: 'Write informative messages in methods'. The message should be a full sentence that clearly states the machine has stopped its work, for example, Bulldozer stopped its work.

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

Choose a reason for hiding this comment

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

This violates checklist item #2: 'Write informative messages in methods'. The message should be a more descriptive sentence, such as 'Truck started its work', to clearly communicate the action.


@Override
public void stopWork() {
System.out.println("stopWork truck");

Choose a reason for hiding this comment

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

This violates checklist item #2: 'Write informative messages in methods'. A more informative message would be a full sentence like 'Truck stopped its work'.

@444Sergey 444Sergey closed this Jan 9, 2026
@444Sergey 444Sergey reopened this Jan 9, 2026
@444Sergey
Copy link
Author

Corrections of mentor's comments

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Great job on this task! You've correctly implemented the abstract Machine class and used polymorphism effectively in the MainApp. The code structure is clean and follows the requirements well.

There is just one very small, consistent typo in your output messages across the Truck, Bulldozer, and Excavator classes. You've used ist instead of its (e.g., "Truck started ist work."). This violates the requirement for messages to be in correct English [CHECKLIST ITEM #2].

Since this is a minor grammatical error and the core logic is perfect, I am approving your solution as an educational override to help you progress. Please remember to correct this small detail in your code. Keep up the excellent work!


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

Footnotes

  1. Rate AI review example

public class Bulldozer extends Machine {
@Override
public void doWork() {
System.out.println("Bulldozer started ist work");

Choose a reason for hiding this comment

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

You're very close! There's a small typo in the message. It should be "its" instead of "ist". This violates checklist item #2, which requires messages to be in English only.


@Override
public void stopWork() {
System.out.println("Bulldozer stopped ist work");

Choose a reason for hiding this comment

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

The same typo is present here. Please change "ist" to "its".

public class Excavator extends Machine {
@Override
public void doWork() {
System.out.println("Excavator started ist work");

Choose a reason for hiding this comment

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

There's a small typo here. It should be its work, not ist work.


@Override
public void stopWork() {
System.out.println("Excavator stopped ist work");

Choose a reason for hiding this comment

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

There's a small typo here as well. It should be its work, not ist work.

public class Truck extends Machine {
@Override
public void doWork() {
System.out.println("Truck started ist work");

Choose a reason for hiding this comment

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

There's a small typo in your output message. It should be "its" instead of "ist". This violates checklist item #2, which requires messages to be in English.


@Override
public void stopWork() {
System.out.println("Truck stopped ist work");

Choose a reason for hiding this comment

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

The same typo is present here. Please change "ist" to "its" to make the message grammatically correct.

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