/** * Represents a primitive organism */ public class Organism{ private Brain b; private Stomach s; private String name; private int numChildren; public Organism(String theName){ b = new Brain(); s = new Stomach(); name = theName; numChildren = 0; } public Organism reproduce(){ numChildren++; return new Organism(name + numChildren); } public void eat(double amount){ s.ingest(amount); } public void digest(){ s.digest(); } public void think(String newThought){ b.setThought(newThought); } public void wakeUp(){ b.setAwake(true); } public void sleep(){ b.setAwake(false); } public String toString(){ String str = "Name: " + name + "\n"; str += "\t" + b.toString() + "\n"; str += "\t" + s.toString() + "\n"; return str; } }