Initial commit
This commit is contained in:
parent
47e1eb9506
commit
4d7a94e602
@ -15,6 +15,7 @@ public abstract class Carnivore extends Animal{
|
||||
int satiety = this.getSatiety();
|
||||
if (food instanceof Meat) {
|
||||
satiety += food.getEnergy();
|
||||
this.setSatiety(satiety);
|
||||
System.out.println("Животное ест.");
|
||||
}
|
||||
else {
|
||||
|
||||
@ -15,6 +15,7 @@ public class Herbivore extends Animal{
|
||||
int satiety = this.getSatiety();
|
||||
if (food instanceof Grass) {
|
||||
satiety += food.getEnergy();
|
||||
this.setSatiety(satiety);
|
||||
System.out.println("Животное ест.");
|
||||
}
|
||||
else {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package employee;
|
||||
|
||||
import animals.Animal;
|
||||
import animals.Swim;
|
||||
import animals.Voice;
|
||||
import food.Food;
|
||||
import food.Grass;
|
||||
@ -19,7 +18,7 @@ public class Worker {
|
||||
}
|
||||
|
||||
public void feed(Animal animal, Food food){
|
||||
String type = new String();
|
||||
String type = "";
|
||||
|
||||
if (food instanceof Grass) type = " травой. ";
|
||||
if (food instanceof Meat) type = " мясом. ";
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package food;
|
||||
|
||||
import javax.naming.Name;
|
||||
|
||||
public abstract class Food {
|
||||
public abstract int getEnergy();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user