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

Add machines #2201

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Tarasmarkov301
Copy link

Add abstract machine and three implemenation

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.

Great job on implementing the task requirements! 🎉 Your code is well-structured and meets all the core requirements. There are just a couple of minor improvements you might consider: correcting a grammatical error in the Excavator class output and using machines.length for scalability in your loop. Keep up the great work and happy coding! 😊

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

public class MainApp {
static Machine[] machines = new Machine[]{new Bulldozer(), new Excavator(), new Truck()};
public static void main(String[] args) {
for (int i = 0; i < 3; i++){

Choose a reason for hiding this comment

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

Consider using machines.length instead of hardcoding the loop limit to 3. This will make the code more flexible and easier to maintain if the number of machines changes in the future.

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

Choose a reason for hiding this comment

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

There is a grammatical error in the output string. Consider changing "Excavator is work" to "Excavator is working" for consistency and correctness.

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.

3 participants