-
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
Create class Machine containing methods public abstract void doWork()… #2244
base: master
Are you sure you want to change the base?
Conversation
… and 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.
Thank you for your effort on this task! 😊 While you've made a good start by setting up the class hierarchy, there are a few critical areas that need attention to meet the core requirements:
-
Abstract Class and Methods: The
Machine
class should be defined as an abstract class, and its methodsdoWork()
andstopWork()
should be abstract. This ensures that each subclass provides its own implementation of these methods. -
Specific Method Behavior: Each subclass (
Truck
,Bulldozer
, andExcavator
) should override thedoWork()
andstopWork()
methods to include specific messages or behaviors that reflect the actions of each machine. Currently, these methods only call the superclass methods, which doesn't demonstrate the unique functionality expected from each subclass. -
Machine Array in MainApp: The
MainApp
class should create an array ofMachine
objects containing instances ofTruck
,Bulldozer
, andExcavator
. It should then iterate over this array to call thedoWork()
andstopWork()
methods, showcasing polymorphism.
Please address these points to align the code with the task requirements. Keep up the good work, and don't hesitate to reach out if you need further guidance! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review
button in the Reviewers tab.
public void doWork() { | ||
super.doWork(); | ||
} |
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 doWork
method in Truck
class only calls super.doWork()
. If the task requires specific behavior for each subclass, consider adding unique functionality here.
public void stopWork() { | ||
super.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.
The stopWork
method in Truck
class only calls super.stopWork()
. If the task requires specific behavior for each subclass, consider adding unique functionality here.
public void doWork() { | ||
super.doWork(); | ||
} |
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 doWork
method in Bulldozer
class only calls super.doWork()
. If the task requires specific behavior for each subclass, consider adding unique functionality here.
public void stopWork() { | ||
super.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.
The stopWork
method in Bulldozer
class only calls super.stopWork()
. If the task requires specific behavior for each subclass, consider adding unique functionality here.
public void doWork() { | ||
super.doWork(); | ||
} |
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 doWork
method in Excavator
class only calls super.doWork()
. If the task requires specific behavior for each subclass, consider adding unique functionality here.
public void stopWork() { | ||
super.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.
The stopWork
method in Excavator
class only calls super.stopWork()
. If the task requires specific behavior for each subclass, consider adding unique functionality here.
… and public abstract void stopWork().
… and public abstract void stopWork().
… and public abstract void stopWork().
… and public abstract void stopWork().
Create class Machine containing methods public abstract void doWork() and public abstract void stopWork().