-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
base: master
Are you sure you want to change the base?
Conversation
…or;) and implements methods; implements class MainApp
There was a problem hiding this 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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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.
Machine truck = new Truck(); | ||
Machine bulldozer = new Bulldozer(); | ||
Machine excavator = new Excavator(); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What it is "cur"?
…or;) and implements methods; implements class MainApp