-
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
created classes of inheritance #2115
base: master
Are you sure you want to change the base?
Conversation
added psvm to 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.
It looks like you've made a great effort on this task! However, there are a few improvements that need to be made to ensure your code is as clear and maintainable as possible. Specifically, the work messages in your machine classes should be more descriptive, and the Machine
class should be publicly accessible. Making these changes will align your code better with the checklist requirements. Keep up the good work, and with these adjustments, your code will be even better! 👍💻
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
@@ -0,0 +1,15 @@ | |||
package core.basesyntax; | |||
|
|||
class Bulldozer extends Machine { |
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 class Bulldozer
should have an access modifier. Consider using the public
modifier to follow the common convention for classes which are likely to be used from other packages.
class Bulldozer extends Machine { | ||
@Override | ||
public void doWork() { | ||
System.out.println("Bulldozer started working."); |
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 in doWork
method is not fully informative. It should indicate that it is a Bulldozer
that is working. Consider changing the message to something like 'Bulldozer is working.' to provide more clarity.
|
||
@Override | ||
public void stopWork() { | ||
System.out.println("Bulldozer stopped working."); |
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 in stopWork
method should be more informative. It should clearly indicate that it is a Bulldozer
that has stopped working. A message like 'Bulldozer has stopped working.' would be more informative.
class Excavator extends Machine { | ||
@Override | ||
public void doWork() { | ||
System.out.println("Excavator started working."); | ||
} | ||
|
||
@Override | ||
public void stopWork() { | ||
System.out.println("Excavator stopped working."); | ||
|
||
} |
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.
Remember to use informative messages in methods. Instead of 'Excavator started working.', it could be more descriptive, indicating what the Excavator is doing specifically. The same applies to the stopWork method.
@@ -0,0 +1,7 @@ | |||
package core.basesyntax; | |||
|
|||
abstract class Machine { |
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 Machine
class should be public to ensure that it can be accessed from other packages if needed.
|
||
@Override | ||
public void doWork() { | ||
System.out.println("Truck started working"); |
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 working' is not very informative. It would be better to indicate what type of work the Truck is performing to make the message more informative as per the checklist.
|
||
@Override | ||
public void stopWork() { | ||
System.out.println("Truck stopped working"); |
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 'Truck stopped working' should be more informative about the type of work the Truck was doing, to comply with the checklist guidelines.
@Override | ||
public void doWork() { | ||
System.out.println("Bulldozer is working."); | ||
|
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.
@Override | ||
public void stopWork() { | ||
System.out.println("Bulldozer has stopped working."); | ||
|
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.
@Override | ||
public void stopWork() { | ||
System.out.println("Excavator stopped digging the ground."); | ||
|
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.
package core.basesyntax; | ||
|
||
class Truck extends Machine { | ||
|
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.
@Override | ||
public void stopWork() { | ||
System.out.println("Truck stopped transporting goods."); | ||
|
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.
added psvm to class MainApp