-
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
jv-oop done #2118
base: master
Are you sure you want to change the base?
jv-oop done #2118
Conversation
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.
Great job on implementing polymorphism in your MainApp class! 👍 The abstract Machine class with its methods is well-defined too. Just remember to make the messages in your doWork
and stopWork
methods more informative in the future. This will make your application's output clearer to users. Keep up the good work! 🌟
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
Machine bulldozer = new Bulldozer(); | ||
Machine truck = new Truck(); | ||
Machine[] machines = new Machine[] {excavator, bulldozer, truck}; | ||
for(Machine machine : 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.
There should not be an empty space between the 'for' keyword and the opening parenthesis to adhere to Java coding standards.
|
||
@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' should be more informative. It's better to indicate that it is a Bulldozer that is working now. For example, 'Bulldozer is now in operation.'
|
||
@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.
The stop message 'Bulldozer stopped working' could be more informative as well. Consider rephrasing it to 'Bulldozer has stopped working.' to make it clear that the Bulldozer has ceased operations.
|
||
@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 printed by the doWork
method should be more informative. According to the checklist, it should indicate the type of machine that is working. Consider updating the message to include the specific type of Machine
, such as 'Excavator is starting its work.'
|
||
@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.
Similar to the doWork
method, the message in stopWork
should also be more informative and indicate the type of machine that stopped working. Update the message to reflect this, for example, 'Excavator has stopped its work.'
|
||
@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 in the doWork
method should be more informative. According to the checklist, it should indicate what type of Machine
is working. Consider specifying that this is a Truck
doing some specific work, for example, 'Truck is hauling cargo'.
|
||
@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 in the stopWork
method should be more informative and indicate that the Truck
has stopped doing its specific work, for example, 'Truck has finished hauling cargo'.
README.md
Outdated
- Create class core.machines.Machine containing methods `public abstract void doWork()` and `public abstract void stopWork()`. | ||
- Create classes `core.machines.Truck`, `core.machines.Bulldozer`, and `core.machines.Excavator` that will inherit from `core.machines.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.
be careful with project-wide renamings, moving files - review your files before committing to avoid unintended changes, please undo the change
public abstract void doWork(); | ||
|
||
public abstract void stopWork(); | ||
|
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.machines; | ||
|
||
public 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.
package core.machines; | ||
|
||
public 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.
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.
clear redundant empty lines
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.
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.
No description provided.