Initial commit

This commit is contained in:
valerpan 2026-07-19 01:41:59 +03:00
parent f8d8b6cc3f
commit 9cfa6e20a2
2 changed files with 10 additions and 0 deletions

View File

@ -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);

View File

@ -27,7 +27,11 @@ 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) {