Skip to content
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
14 changes: 14 additions & 0 deletions src/main/java/core/basesyntax/Bulldozer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package core.basesyntax;

public class Bulldozer extends Machine {

@Override
public void doWork() {
System.out.println("The bulldozer is working.");

Choose a reason for hiding this comment

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

The printed messages should use "Bulldozer" (capitalized) instead of "bulldozer" to clearly indicate the machine type, as required by the checklist: "All messages printed in doWork() and stopWork() must be in English and must be informative, indicating the type of machine (Truck, Bulldozer, or Excavator) that is working or stopped."

}

@Override
public void stopWork() {
System.out.println("The bulldozer has stopped.");

Choose a reason for hiding this comment

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

The printed messages should use "Bulldozer" (capitalized) instead of "bulldozer" to clearly indicate the machine type, as required by the checklist: "All messages printed in doWork() and stopWork() must be in English and must be informative, indicating the type of machine (Truck, Bulldozer, or Excavator) that is working or stopped."

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

public class Excavator extends Machine{

@Override
public void doWork() {
System.out.println("The excavator is working.");

Choose a reason for hiding this comment

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

The printed messages should use "Excavator" (capitalized) instead of "excavator" to clearly indicate the machine type, as required by the checklist: "All messages printed in doWork() and stopWork() must be in English and must be informative, indicating the type of machine (Truck, Bulldozer, or Excavator) that is working or stopped."

}

@Override
public void stopWork() {
System.out.println("The excavator has stopped.");

Choose a reason for hiding this comment

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

The printed messages should use "Excavator" (capitalized) instead of "excavator" to clearly indicate the machine type, as required by the checklist: "All messages printed in doWork() and stopWork() must be in English and must be informative, indicating the type of machine (Truck, Bulldozer, or Excavator) that is working or stopped."

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

public abstract class Machine {

public abstract void doWork();
public abstract void stopWork();
}
13 changes: 12 additions & 1 deletion src/main/java/core/basesyntax/MainApp.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
package core.basesyntax;

public class MainApp {
public static void Main () {

Choose a reason for hiding this comment

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

The main method is incorrectly named Main and does not have the correct signature. It should be public static void main(String[] args) to serve as the Java entry point. This violates checklist item #1: "In MainApp, create an array of type Machine containing instances of Truck, Bulldozer, and Excavator" and the general requirement for a valid Java main method.

Machine[] machines = new Machine[3];

}
machines[0] = new Truck();
machines[1] = new Bulldozer();
machines[2] = new Excavator();

for (Machine machine : machines) {
machine.doWork();
machine.stopWork();
}
}
}
14 changes: 14 additions & 0 deletions src/main/java/core/basesyntax/Truck.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package core.basesyntax;

public class Truck extends Machine {

@Override
public void doWork() {
System.out.println("The truck is working.");

Choose a reason for hiding this comment

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

The printed messages should use "Truck" (capitalized) instead of "truck" to clearly indicate the machine type, as required by the checklist: "All messages printed in doWork() and stopWork() must be in English and must be informative, indicating the type of machine (Truck, Bulldozer, or Excavator) that is working or stopped."

}

@Override
public void stopWork() {
System.out.println("The truck has stopped.");

Choose a reason for hiding this comment

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

The printed messages should use "Truck" (capitalized) instead of "truck" to clearly indicate the machine type, as required by the checklist: "All messages printed in doWork() and stopWork() must be in English and must be informative, indicating the type of machine (Truck, Bulldozer, or Excavator) that is working or stopped."

}
}
Loading