// The idea of the program: A user can create cats (using the command c) // and myriapods (m), advence to the next day (d), print info about // existing animals (p), and make cats mew (m). // Myriapods grow daily a new pair of legs. // ---------- Page 1 of program listing -------------------- import java.util.ArrayList; public class Animals { public static void main(String[] args) { // Java 1.4: ArrayList all = new ArrayList(5); // Java 1.5: ArrayList all = new ArrayList(5); ArrayList all = new ArrayList(5); int i; Animal a; char x='a'; while (x != 'q') { x = Input.readChar(); switch (x) { case 'c': all.add(new Cat(Input.readInputLine(), Input.readInputLine())); break; case 'm': all.add(new Myriapod(Input.readInt())); break; case 'd': for (i=0; i