Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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
| private String name; | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public void setName(String name) { | ||
| this.name = name; | ||
| } |
There was a problem hiding this comment.
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.
| truck.setName("truck"); | ||
|
|
||
| Machine bulldozer = new Bulldozer(); | ||
| bulldozer.setName("bulldozer"); | ||
|
|
||
| Machine excavator = new Excavator(); | ||
| excavator.setName("excavator"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
This violates checklist item #2: 'Write informative messages in methods'. A more informative message would be a full sentence like 'Truck stopped its work'.
|
Corrections of mentor's comments |
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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
| public class Bulldozer extends Machine { | ||
| @Override | ||
| public void doWork() { | ||
| System.out.println("Bulldozer started ist work"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
The same typo is present here. Please change "ist" to "its" to make the message grammatically correct.
No description provided.