AB version
1. B 2. B 3. D 4. A. 5. C 6. A 7. A 8. E 9. A
10. (Same for both tests)
a.
public class AgingFish extends Fish
{
private double probdying;
private int myAge;
public AgingFish(Environment env, Location loc){...}
public AgingFish(Environment env, Location loc, Direction dir){...}
public AgingFish(Environment env, Location loc, Direction dir, Color col){...}
public void act(){...}
public void generateChild(location loc){...}
}
b.
public AgingFish(Environment env, Location loc)
{
super(env,loc,env.randomDirection(),Color.blue);
myAge = 0;
probdying = 1.0/7.0;
}
c.
public void act()
{
if(!isInEnv())
return;
if(myAge < 3 || myAge > 10 || !breed())
move();
if(myAge >= 3)
probdying += .1;
Random randNumGen = RandNumGenerator.getInstance();
if(randNumGen.nextDouble() < probdying)
die();
myAge++;
}