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

added class Machine, Truck, Bulldozer, Excavator and called methods d… #1563

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

Conversation

tbasy
Copy link

@tbasy tbasy commented Jul 27, 2023

…oWork, stopWork

package core.basesyntax;

public class Bulldozer extends Machine {

Copy link

Choose a reason for hiding this comment

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

mate checkstyle doesn't provide for a line after class definition, please fix everywhere

Suggested change

Comment on lines 5 to 8
String[] Machine;
String Truck = new String();
String Bulldozer = new String();
String Excavator = new String();
Copy link

Choose a reason for hiding this comment

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

why do you create strings here? Create machine array instead: new Machine[]{new Truck(), etc}

Copy link

@okuzan okuzan left a comment

Choose a reason for hiding this comment

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

Please, make sure the build passes before requesting a review (locally you can run mvn clean package)

@tbasy tbasy requested a review from okuzan July 31, 2023 12:36
Comment on lines 4 to 17
public static void main(String[] args) {
Machine[] machines = new Machine[]{new Truck(), new Bulldozer(), new Excavator()};
Machine truck = new Truck();
truck.doWork();
truck.stopWork();

Machine bulldozer = new Bulldozer();
bulldozer.doWork();
bulldozer.stopWork();

Machine excavator = new Excavator();
excavator.doWork();
excavator.stopWork();
}

Choose a reason for hiding this comment

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

try using a `for' loop for machines

Suggested change
public static void main(String[] args) {
Machine[] machines = new Machine[]{new Truck(), new Bulldozer(), new Excavator()};
Machine truck = new Truck();
truck.doWork();
truck.stopWork();
Machine bulldozer = new Bulldozer();
bulldozer.doWork();
bulldozer.stopWork();
Machine excavator = new Excavator();
excavator.doWork();
excavator.stopWork();
}
public static void main(String[] args) {
Machine[] machines = new Machine[]{new Truck(), new Bulldozer(), new Excavator()};
// here
}

@tbasy tbasy requested a review from Ivan95kos August 17, 2023 14:14
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.

4 participants