Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 15 additions & 0 deletions CoffeeRobot.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

public class CoffeeRobot extends Robot{

public CoffeeRobot(String name, String function, String color) {
super(name, function, color);

}

public void work () {
System.out.println("� CoffeRobot � � ���� ����");
}
}



17 changes: 17 additions & 0 deletions Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

public class Main {

public static void main(String[] args) {
// TODO Auto-generated method stub
Robot myRobot = new Robot ("Vasya","toWork","red");
System.out.println("I am robot" + myRobot.name+"and mycolor is " +myRobot.color);
Robot myCoffeeRobot = new CoffeeRobot("Bob","MakeCoffee","gray");
Robot myRobotDancer = new RobotDancer("Ron","toDance", "blue",12);
Robot myRobotCook = new RobotCook("Simon", "toCook","violet");

myRobot.work();
myCoffeeRobot.work();
myRobotDancer.work();
myRobotCook.work();
}
}
20 changes: 20 additions & 0 deletions Robot.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

public class Robot {
public String name;
public String function;
public String color;



public Robot(String name, String function, String color) {

this.name = name;
this.function = function;
this.color = color;
}


public void work () {
System.out.println("� Robot � � ������ ������");
}
}
13 changes: 13 additions & 0 deletions RobotCook.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

public class RobotCook extends Robot{


public RobotCook(String name, String function, String color) {
super(name, function, color);

}

public void work () {
System.out.println("� RobotCook � � ������ �����");
}
}
16 changes: 16 additions & 0 deletions RobotDancer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

public class RobotDancer extends Robot{
public int age;


public RobotDancer(String name, String function, String color, int age) {
super(name, function, color);
this.age=age;
}



public void work () {
System.out.println("ß RobotDancer – ÿ ïðîñòî òàíöþþ");
}
}