9 date 2008.03.23.18.04.22; author rmh3093; state Exp;
14 date 2008.03.23.16.58.02; author rmh3093; state Exp;
19 date 2008.03.23.15.11.54; author rmh3093; state Exp;
24 date 2008.03.23.13.55.00; author rmh3093; state Exp;
30 @Initial commit, should work
43 * $Id: TestCreature.java,v 1.3 2008/03/23 16:58:02 rmh3093 Exp rmh3093 $
46 * $Log: TestCreature.java,v $
47 * Revision 1.3 2008/03/23 16:58:02 rmh3093
50 * Revision 1.2 2008/03/23 15:11:54 rmh3093
53 * Revision 1.1 2008/03/23 13:55:00 rmh3093
59 * TestCreature is a tester/demonstration program to exercise the Thing class
60 * hierarchy. Students write this and submit it; try uses another tester.
62 public class TestCreature {
64 public static final int THING_COUNT = 6;
65 public static final int CREATURE_COUNT = 10;
68 * Create new TestCreature
70 public TestCreature() {
74 * Main method for program.
77 * command line arguments (ignored)
79 public static void main(String args[]) {
80 final Creature[] creatures = new Creature[4];
81 creatures[0] = new Tiger("tiger0");
82 creatures[1] = new Ant("ant1");
83 creatures[2] = new Bat("bat2");
84 creatures[3] = new Fly("fly3");
85 for (Creature c : creatures) {
86 System.out.println(c);
88 c.eat(new Thing("thing"));
89 c.eat(new Fly("creature"));
105 * $Id: TestCreature.java,v 1.2 2008/03/23 15:11:54 rmh3093 Exp rmh3093 $
109 final Creature[] creatures = new Creature[CREATURE_COUNT];
111 System.out.println(creatures[0]);
113 System.out.println(creatures[1]);
115 System.out.println(creatures[2]);
118 System.out.println(creatures[3]);
129 * $Id: TestCreature.java,v 1.1 2008/03/23 13:55:00 rmh3093 Exp rmh3093 $
132 final Thing[] things = new Thing[THING_COUNT];
133 for (int i = 0; i < THING_COUNT; i++) {
134 things[i] = new Thing("thing" + i);
135 System.out.println(things[i]);
139 for (int i = 0; i < CREATURE_COUNT; i++) {
140 creatures[i] = new Tiger("tiger" + i);
141 System.out.println(creatures[i]);
160 public class TestCreature {
163 public static final int THING_COUNT = 6;
164 public static final int CREATURE_COUNT = 10;
167 * Create new TestCreature
169 public TestCreature() {
174 * Main method for program.
176 * @@param args command line arguments (ignored)
178 public static void main( String args[] ) {
179 Thing[] things = new Thing[THING_COUNT];
180 for (int i=0; i<THING_COUNT; i++) {
181 things[i] = new Thing("thing"+i);
182 System.out.println(things[i]);
184 Creature[] creatures = new Creature[CREATURE_COUNT];
185 for (int i=0; i<CREATURE_COUNT; i++) {
186 creatures[i] = new Tiger("tiger"+i);
187 System.out.println(creatures[i]);