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

created classes, overridden abstract methods, and created an array of… #2119

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

Conversation

FireFalcons
Copy link

@FireFalcons FireFalcons commented Aug 22, 2024

No description provided.

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 and MainApp class! 🌟 Your use of abstraction and polymorphism is spot-on. As for the naming convention of the machines array, it's a minor issue and doesn't impact the functionality. Keep up the good work, and consider using plural names for collections in the future for better clarity. Happy coding! 👍

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

@@ -0,0 +1,14 @@
package core.basesyntax;

public class Bulldozer extends Machine{

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 line after the class declaration. Please remove the redundant empty line.


@Override
public void doWork() {
System.out.println("the bulldozer started it`s work");

Choose a reason for hiding this comment

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

The message should be more informative and indicate that it is a Bulldozer that is working. For example: 'Bulldozer started its work.'


@Override
public void stopWork() {
System.out.println("the bulldozer stopped it`s work");

Choose a reason for hiding this comment

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

The message should be more informative and indicate that it is a Bulldozer that has stopped working. For example: 'Bulldozer stopped its work.' Also, use the correct possessive form 'its' instead of 'it`s'.


@Override
public void doWork() {
System.out.println("the excavator started it`s work");

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 and indicate that it is an Excavator that is working. Consider specifying the machine type in the message.


@Override
public void stopWork() {
System.out.println("the excavator stopped it`s work");

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 indicate that it is an Excavator that has stopped working. Make sure the message is clear and informative.


@Override
public void stopWork() {
System.out.println("the excavator stopped it`s work");

Choose a reason for hiding this comment

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

Use proper apostrophes in it's instead of backticks. The correct punctuation for contraction of 'it is' is it's.

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

Choose a reason for hiding this comment

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

The array name machine should be plural to reflect that it contains multiple machines. A better name would be machines. This enhances the readability and understanding of the code.

@@ -0,0 +1,14 @@
package core.basesyntax;

public class Truck extends Machine{

Choose a reason for hiding this comment

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

There is an unnecessary empty line after the class declaration (line 2). According to the checklist, we should not add redundant empty lines after class declaration.


@Override
public void doWork() {
System.out.println("the truck started it`s work");

Choose a reason for hiding this comment

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

The message in the System.out.println should be more informative and indicate the type of machine. For example, "Truck started its work".


@Override
public void stopWork() {
System.out.println("the truck stopped it`s work");

Choose a reason for hiding this comment

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

Similarly, the stop message should be informative. Consider changing it to "Truck stopped its work".

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 setting up the abstract Machine class and its methods! 🌟 Remember to always keep your messages informative to make the code more readable. Keep up the good work, and consider the provided feedback for future improvements! 👍

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

@@ -0,0 +1,14 @@
package core.basesyntax;

public class Bulldozer extends Machine{

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 line after the class declaration. Please remove the redundant empty line to comply with the coding style guidelines.


@Override
public void doWork() {
System.out.println("the bulldozer started it`s work");

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 and indicate that it is a Bulldozer that is working. For example, 'Bulldozer started its work'. Also, use 'its' instead of it's to indicate possession.


@Override
public void stopWork() {
System.out.println("the bulldozer stopped it`s work");

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 it is a Bulldozer that has stopped working. For example, 'Bulldozer stopped its work'. Again, use 'its' instead of it's.


@Override
public void doWork() {
System.out.println("the excavator started it`s work");

Choose a reason for hiding this comment

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

The message should be more informative and indicate that it is an Excavator that is working. Consider rephrasing to something like 'Excavator started working.'


@Override
public void stopWork() {
System.out.println("the excavator stopped it`s work");

Choose a reason for hiding this comment

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

Similarly, the stop message should be more informative. It should clearly state that it is an Excavator that has stopped working. For example, 'Excavator stopped working.'

@@ -0,0 +1,14 @@
package core.basesyntax;

public class Truck extends Machine{

Choose a reason for hiding this comment

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

There's a missing space between the class name Truck and the curly brace {. It should be Truck extends Machine { to follow Java code conventions.


@Override
public void doWork() {
System.out.println("the truck started it`s work");

Choose a reason for hiding this comment

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

The message in System.out.println should be more informative and indicate that it is a Truck that is working. For example: System.out.println("Truck started its work.");


@Override
public void stopWork() {
System.out.println("the truck stopped it`s work");

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 should be more informative. Use Truck stopped its work. to clearly indicate which machine stopped working.


@Override
public void doWork() {
System.out.println("the truck started it`s work");

Choose a reason for hiding this comment

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

Replace the backtick () with an apostrophe (') in it'sto use the correct punctuation for the contraction ofit is`.


@Override
public void stopWork() {
System.out.println("the truck stopped it`s work");

Choose a reason for hiding this comment

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

Replace the backtick () with an apostrophe (') in it'sto use the correct punctuation for the contraction ofit is`.

@@ -0,0 +1,12 @@
package core.basesyntax;

Choose a reason for hiding this comment

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

Suggested change
package core.basesyntax;
package core.basesyntax;

@@ -0,0 +1,12 @@
package core.basesyntax;

Choose a reason for hiding this comment

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

Suggested change
package core.basesyntax;
package core.basesyntax;

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

Choose a reason for hiding this comment

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

Suggested change
package core.basesyntax;
package core.basesyntax;

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

Choose a reason for hiding this comment

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

revert empty line

public class MainApp {
public static void main(String[] args) {

Choose a reason for hiding this comment

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

Suggested change

Comment on lines 10 to 13
for (Machine m : machines) {
m.doWork();
m.stopWork();
System.out.println();

Choose a reason for hiding this comment

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

Suggested change
for (Machine m : machines) {
m.doWork();
m.stopWork();
System.out.println();
for (Machine machine : machines) {
machine.doWork();
machine.stopWork();

@@ -0,0 +1,12 @@
package core.basesyntax;

Choose a reason for hiding this comment

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

Suggested change
package core.basesyntax;
package core.basesyntax;

@Elena-Bruyako
Copy link

Fix build

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