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

1 #2208

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

YarikNarozhnyi
Copy link

1

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 Machine class hierarchy! 🚜 While your code has a solid foundation, there are a few key areas to address to ensure it functions correctly:

  1. Syntax Errors: Ensure all System.out.println statements in the Bulldozer, Truck, and Excavator classes end with semicolons. This is crucial for the code to compile and run.

  2. Code Structure: The for loop in the MainApp class should be placed inside a method, such as the main method, to execute properly.

  3. Access Modifiers: Consider adding an access modifier to the Machine array in MainApp to adhere to encapsulation principles.

  4. Redundant Empty Lines: Remove any unnecessary empty lines after class declarations or method signatures for cleaner code.

Your effort is commendable, and addressing these issues will enhance your understanding and coding skills. Keep up the good work, and remember to learn from these points to avoid similar issues in the future. Happy coding! 😊

✨ 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 working")

Choose a reason for hiding this comment

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

There is a missing semicolon at the end of this line. Java statements must end with a semicolon.

}
@Override
public void stopWork() {
System.out.println("Bulldozer stopped working")

Choose a reason for hiding this comment

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

There is a missing semicolon at the end of this line. Java statements must end with a semicolon.

public class Excavator extends Machine {
@Override
public void doWork() {
System.out.println("Excavator started working")

Choose a reason for hiding this comment

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

There is a missing semicolon at the end of this line. Java statements must end with a semicolon.

}
@Override
public void stopWork() {
System.out.println("Excavator stopped working")

Choose a reason for hiding this comment

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

There is a missing semicolon at the end of this line. Java statements must end with a semicolon.

public class Truck extends Machine {
@Override
public void doWork() {
System.out.println("Truck started working")

Choose a reason for hiding this comment

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

There is a missing semicolon at the end of this line. Java statements must end with a semicolon.

}
@Override
public void stopWork() {
System.out.println("Truck stopped working")

Choose a reason for hiding this comment

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

There is a missing semicolon at the end of this line. Java statements must end with a semicolon.

@@ -1,5 +1,9 @@
package core.basesyntax;

public class MainApp {

Machine[] machine = new Machine[]{new Truck(), new Bulldozer(), new Excavator()};

Choose a reason for hiding this comment

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

The array declaration is correct, but the loop that follows is not properly enclosed within a method. In Java, code must be inside a method or constructor.

@@ -1,5 +1,9 @@
package core.basesyntax;

public class MainApp {

Machine[] machine = new Machine[]{new Truck(), new Bulldozer(), new Excavator()};
for (int i = 0;i < machine.length;i++) {

Choose a reason for hiding this comment

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

The for loop is not inside any method or constructor. You need to place this loop inside a main method or another method to execute it properly.

@YarikNarozhnyi YarikNarozhnyi deleted the codespace-silver-acorn-wr94rjgg94j4f56qv branch November 14, 2024 17:56
@YarikNarozhnyi
Copy link
Author

2

@YarikNarozhnyi
Copy link
Author

3

@YarikNarozhnyi
Copy link
Author

5

Copy link

@volodymyr-soltys97 volodymyr-soltys97 left a comment

Choose a reason for hiding this comment

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

Hi, this task isn't frontend course, you need to switch to another course on the platform

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