Skip to content
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

implements class Machine; create new class (Truck, Bulldozer, Excavat… #2111

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mkarmadev
Copy link

…or;) and implements methods; implements class MainApp

…or;) and implements methods; implements class MainApp
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.

Hey there! It looks like there's a bit of room for improvement in the messages for starting and stopping work across different machine types. It's important that these messages are clear and informative, so users know exactly which machine is in action. Don't worry, these are small tweaks that can make a big difference in clarity! Keep up the good work, and with those changes, your code will be even better! 🛠️💼

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

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

Choose a reason for hiding this comment

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

The message 'Bulldozer started work' could be more informative. It should indicate that it is the Bulldozer machine that is working. Consider including the class name in the message.


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

Choose a reason for hiding this comment

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

Similarly, the message 'Bulldozer stopped work' could be more informative by including the class name to clearly indicate that it is the Bulldozer machine that has stopped working.

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

Choose a reason for hiding this comment

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

The message "Excavator started work" is not very informative. Consider specifying that it is the Excavator machine that is working, to make it clear and informative as per the checklist.


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

Choose a reason for hiding this comment

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

Similarly, the message "Excavator stopped work" should be more informative. Indicate that it is the Excavator machine that has stopped working.

Comment on lines +5 to +7
Machine truck = new Truck();
Machine bulldozer = new Bulldozer();
Machine excavator = new Excavator();

Choose a reason for hiding this comment

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

You have correctly used abstract references (Machine) instead of specific ones for the objects. This allows the use of polymorphism in the code.

@@ -1,5 +1,16 @@
package core.basesyntax;

public class MainApp {
public static void main(String[] args) {

Choose a reason for hiding this comment

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

Please remove the redundant empty line after the class declaration (line 3). According to the checklist, we don't need empty lines after class declaration or method signature.

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

Choose a reason for hiding this comment

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

The message 'Truck started work' could be more informative. According to the checklist, it should indicate the type of Machine that is working. Consider specifying that it's a Truck that has started its work, for example: 'Truck is now working.'


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

Choose a reason for hiding this comment

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

Similarly to the doWork method, the message in stopWork should also be more informative. Indicate that it's a Truck that has stopped its work, for example: 'Truck has stopped working.'


Machine[] machines = {truck, bulldozer, excavator};

for (Machine cur : machines) {

Choose a reason for hiding this comment

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

What it is "cur"?

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.

4 participants