new seed
[rmh3093.git] / lab2 / RCS / TestCreature.java,v
blob7bb182876f6233e1c5ada02a1201dae4970259a1
1 head    1.4;
2 access;
3 symbols;
4 locks; strict;
5 comment @# @;
8 1.4
9 date    2008.03.23.18.04.22;    author rmh3093; state Exp;
10 branches;
11 next    1.3;
13 1.3
14 date    2008.03.23.16.58.02;    author rmh3093; state Exp;
15 branches;
16 next    1.2;
18 1.2
19 date    2008.03.23.15.11.54;    author rmh3093; state Exp;
20 branches;
21 next    1.1;
23 1.1
24 date    2008.03.23.13.55.00;    author rmh3093; state Exp;
25 branches;
26 next    ;
29 desc
30 @Initial commit, should work
34 1.4
35 log
36 @update test program
38 text
39 @/*
40  * TestCreature.java
41  *
42  * Version:
43  *     $Id: TestCreature.java,v 1.3 2008/03/23 16:58:02 rmh3093 Exp rmh3093 $
44  *
45  * Revisions:
46  *     $Log: TestCreature.java,v $
47  *     Revision 1.3  2008/03/23 16:58:02  rmh3093
48  *     test each creature
49  *
50  *     Revision 1.2  2008/03/23 15:11:54  rmh3093
51  *     Cleanups
52  *
53  *     Revision 1.1  2008/03/23 13:55:00  rmh3093
54  *     Initial revision
55  *
56  */
58 /**
59  * TestCreature is a tester/demonstration program to exercise the Thing class
60  * hierarchy. Students write this and submit it; try uses another tester.
61  */
62 public class TestCreature {
64         public static final int THING_COUNT = 6;
65         public static final int CREATURE_COUNT = 10;
67         /**
68          * Create new TestCreature
69          */
70         public TestCreature() {
71         }
73         /**
74          * Main method for program.
75          * 
76          * @@param args
77          *            command line arguments (ignored)
78          */
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);
87                         c.move();
88                         c.eat(new Thing("thing"));
89                         c.eat(new Fly("creature"));
90                         c.whatDidYouEat();
91                 }
92         }
98 1.3
99 log
100 @test each creature
102 text
103 @d5 1
104 a5 1
105  *     $Id: TestCreature.java,v 1.2 2008/03/23 15:11:54 rmh3093 Exp rmh3093 $
106 d9 3
107 d42 1
108 a42 1
109                 final Creature[] creatures = new Creature[CREATURE_COUNT];
110 a43 1
111                 System.out.println(creatures[0]);
112 a44 1
113                 System.out.println(creatures[1]);
114 a45 1
115                 System.out.println(creatures[2]);
116 d47 7
117 a53 1
118                 System.out.println(creatures[3]);
124 @Cleanups
126 text
127 @d5 1
128 a5 1
129  *     $Id: TestCreature.java,v 1.1 2008/03/23 13:55:00 rmh3093 Exp rmh3093 $
130 d9 3
131 a38 5
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]);
136                 }
137 d40 8
138 a47 4
139                 for (int i = 0; i < CREATURE_COUNT; i++) {
140                         creatures[i] = new Tiger("tiger" + i);
141                         System.out.println(creatures[i]);
142                 }
148 @Initial revision
150 text
151 @d5 1
152 a5 1
153  *     $Id$
154 d8 9
155 a16 1
156  *     $Log$
157 d18 4
158 d23 5
159 a27 1
160  public class TestCreature {
161 d29 18
162 a46 8
163          public static final int THING_COUNT = 6;
164          public static final int CREATURE_COUNT = 10;
165          
166          /**
167           * Create new TestCreature
168           */
169          public TestCreature() {
170          }
171 d48 1
172 a48 19
173          /**
174           * Main method for program.
175           *
176           * @@param args command line arguments (ignored)
177           */
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]);
183                   }
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]);
188                   }
189           }
190