/* WhiteMouse.java example code AC Chapin */ package mouses; /** * a mouse used for experimentation * @author AChapin */ public class WhiteMouse { // Instance variables are public. I am filled with shame. // primitive instance variables public int idNum; // identification public int age; // lifespan public boolean control; // is this mouse in the control group // reference instance variables public WhiteMouse mother; public WhiteMouse father; /** * expose the mouse to a chemical * @param chemical what are we exposing the mouse to? */ public void exposeTo(String chemical) { System.out.println("Mouse \t#" + IDnum); // if we don't check, we could have a null pointer exception if (mother != null) { System.out.println(" M\t#" + mother.idNum); } if (father != null) { System.out.println(" F\t#" + father.idNum); } System.out.println(" has been treated with " + chemical); // no longer in the control group control = false; } public String toString() { return "Mouse ID#" + idNum + " lived " + age + " days and was in the control group: " + control; } }