Initial commit
This commit is contained in:
parent
f8d8b6cc3f
commit
9cfa6e20a2
@ -53,6 +53,12 @@ public class Zoo {
|
||||
worker2.feed(duck1, grass);
|
||||
worker2.feed(sheep1, meat);
|
||||
|
||||
Duck duck2 = new Duck();
|
||||
Worker worker3 = new Worker();
|
||||
System.out.println("Кормим уток. Начальная сытость = " + duck2.getSatiety() + ".");
|
||||
worker3.feed(duck2, grass);
|
||||
System.out.println("Конечная сытость = " + duck2.getSatiety() + ".");
|
||||
|
||||
worker1.getVoice(bear1);
|
||||
worker1.getVoice(kotik1);
|
||||
|
||||
|
||||
@ -27,8 +27,12 @@ public class Worker {
|
||||
System.out.println(this.getName() + " кормит животное " + animal.getName() + type);
|
||||
animal.eat(food);
|
||||
}
|
||||
else{
|
||||
animal.eat(food);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void getVoice(Voice voiceAnimal) {
|
||||
if (voiceAnimal instanceof Animal) {
|
||||
Animal animal = (Animal) voiceAnimal;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user