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

Final solution #2107

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/main/java/core/basesyntax/Bulldozer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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 be a space between the class name and the curly brace to follow the Java code conventions.



@Override
public void doWork() {
System.out.println("Bulldozer start working!");

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. It should indicate that it is a 'Bulldozer' that is working. Although the message does include 'Bulldozer', consider rephrasing to 'The bulldozer has started working' to be more descriptive.

}

@Override
public void stopWork() {
System.out.println("Bulldozer stop working!");

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. It should indicate that it is a 'Bulldozer' that has stopped working. Consider rephrasing to 'The bulldozer has stopped working' to be more descriptive.


}

}
16 changes: 16 additions & 0 deletions src/main/java/core/basesyntax/Excavator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package core.basesyntax;

public class Excavator extends Machine {


@Override
public void doWork() {
System.out.println("Excavator start working!");

Choose a reason for hiding this comment

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

The message "Excavator start working!" should be more informative and indicate that it is an Excavator that is working. Consider specifying the action the Excavator is performing, for example, "Excavator is digging."

}

@Override
public void stopWork() {
System.out.println("Excavator stop working!");

Choose a reason for hiding this comment

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

Similarly, the stop message "Excavator stop working!" should be more informative. It could be improved to "Excavator has finished digging." to clearly indicate the state of the Excavator.


}
}
6 changes: 6 additions & 0 deletions src/main/java/core/basesyntax/Machine.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package core.basesyntax;

public abstract class Machine {
public abstract void doWork();
public abstract void stopWork();
}
27 changes: 27 additions & 0 deletions src/main/java/core/basesyntax/MainApp.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
package core.basesyntax;

public class MainApp {
public static void main(String[] args) {
Machine truck;
truck = new Truck();

Machine bulldozer = new Bulldozer();

Machine excavator = new Excavator();
//tablica z obiektami

Choose a reason for hiding this comment

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

Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature.


Machine[] carPark = {truck , bulldozer , excavator };

// stworzyc petle for ktora wyswietli do i stop work

Choose a reason for hiding this comment

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

Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature.


for (int i = 0; i < carPark.length; i++) {
carPark[i].doWork();
carPark[i].stopWork();


Choose a reason for hiding this comment

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

Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature.

}


// stworzyc maszyny z podanych wczesniej 3 typow
// i sprawdzic czy wywietlaja sie wiadomosci na konsoli



Choose a reason for hiding this comment

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

Please remove these redundant empty lines to improve the readability of your code.

}
}

16 changes: 16 additions & 0 deletions src/main/java/core/basesyntax/Truck.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package core.basesyntax;

public class Truck extends Machine {

@Override
public void doWork() {
System.out.println("Truck start working!");

Choose a reason for hiding this comment

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

The message 'Truck start working!' should be more informative and indicate that it's a Truck that is working. Consider rephrasing it to include the type of machine, for example: 'Truck is now working.'


}

@Override
public void stopWork() {
System.out.println("Truck stop working!");

Choose a reason for hiding this comment

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

Similarly, the message 'Truck stop working!' should clearly indicate the machine type. You could rephrase it to 'Truck has stopped working.' to make it more informative.


}
}
Loading