Skip to content

Commit

Permalink
Merge branch 'new_branch' of https://github.com/VitaliyProgrammer/jv-oop
Browse files Browse the repository at this point in the history
 into new_branch
  • Loading branch information
VitaliyProgrammer committed Dec 3, 2023
2 parents 8587cb7 + 75abd08 commit baebed9
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/java/core/basesyntax/Buldozer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.example;

public class Buldozer extends Machine
{
@Override
public void doWork()
{
System.out.println("Bulldozer started its work.");
}

@Override
public void stopWork()
{
System.out.println("Bulldozer stopped working.");
}
}
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 org.example;

public class Excavator extends Machine
{
@Override
public void doWork()
{
System.out.println("Excavator started its work.");
}

@Override
public void stopWork()
{
System.out.println("Excavator stopped working.");
}
}
8 changes: 8 additions & 0 deletions src/main/java/core/basesyntax/Machine.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.example;

abstract public class Machine
{
public abstract void doWork();

public abstract void stopWork();
}
18 changes: 18 additions & 0 deletions src/main/java/core/basesyntax/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.example;

public class Main
{
public static void main(String[] args)
{
Machine[] machines = { new Truck(), new Buldozer(), new Excavator() };

for (Machine car: machines)
{
car.doWork();
car.stopWork();
System.out.println("\n");
}
}


}
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 org.example;

public class Truck extends Machine
{
@Override
public void doWork()
{
System.out.println("Truck started its work.");
}

@Override
public void stopWork()
{
System.out.println("Truck stopped working.");
}
}
16 changes: 16 additions & 0 deletions src/main/java/org/example/Buldozer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.example;

public class Buldozer extends Machine
{
@Override
public void doWork()
{
System.out.println("Bulldozer started its work.");
}

@Override
public void stopWork()
{
System.out.println("Bulldozer stopped working.");
}
}
16 changes: 16 additions & 0 deletions src/main/java/org/example/Excavator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.example;

public class Excavator extends Machine
{
@Override
public void doWork()
{
System.out.println("Excavator started its work.");
}

@Override
public void stopWork()
{
System.out.println("Excavator stopped working.");
}
}
8 changes: 8 additions & 0 deletions src/main/java/org/example/Machine.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.example;

abstract public class Machine
{
public abstract void doWork();

public abstract void stopWork();
}
16 changes: 16 additions & 0 deletions src/main/java/org/example/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.example;

public class Main
{
public static void main(String[] args)
{
Machine[] machines = {new Truck(), new Buldozer(), new Excavator()};

for (Machine car: machines)
{
car.doWork();
car.stopWork();
System.out.println("\n");
}
}
}
15 changes: 15 additions & 0 deletions src/main/java/org/example/Truck.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.example;

public class Truck extends Machine
{ @Override
public void doWork()
{
System.out.println("Truck started its work.");
}

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

0 comments on commit baebed9

Please sign in to comment.