I have a small simulator that simulates foxes and rabbits... I am trying to make fox and rabbit classes to implement actor class, but I get this error message, and i dont know whats wrong..
Error message: rabbit Is not abstract and does not override abstract method act (java.until.List) in Actor
Rabbit class
import java.util.List;
import java.util.Random;
public class Rabbit extends Animal implements Actor
{
// Characteristics shared by all rabbits (static fields).
// The age at which a rabbit can start to breed.
private static final int BREEDING_AGE = 5;
// The age to which a rabbit can live.
private static final int MAX_AGE = 40;
// The likelihood of a rabbit breeding.
private static final double BREEDING_PROBABILITY = 0.15;
// The maximum number of births.
private static final int MAX_LITTER_SIZE = 4;
/**
* Create a new rabbit. A rabbit may be created with age
* zero (a new born) or with a random age.
*
* @param randomAge If true, the rabbit will have a random age.
* @param field The field currently occupied.
* @param location The location within the field.
*/
public Rabbit(boolean randomAge, Field field, Location location)
{
super(field, location);
if(randomAge) {
setAge(rand.nextInt(MAX_AGE));
}
}
/**
* This is what the rabbit does most of the time - it runs
* around. Sometimes it will breed or die of old age.
* @param newRabbits A list to add newly born rabbits to.
*/
public void act(List<Actor> newActors)
{
incrementAge();
if(isActive()) {
giveBirth(newRabbits);
// Try to move into a free location.
Location newLocation = getField().freeAdjacentLocation(getLocation());
if(newLocation != null) {
setLocation(newLocation);
}
else {
// Overcrowding.
setDead();
}
}
}
public Animal getNewAnimal(boolean status, Field field, Location loc)
{
return new Rabbit(status, field, loc);
}
/**
* Return the maximal age of the rabbit.
* @return The maximal age of the rabbit.
*/
protected int getMaxAge()
{
return MAX_AGE;
}
/**
* Return the breeding age of the rabbit.
* @return The breeding age of the rabbit.
*/
protected int getBreedingAge()
{
return BREEDING_AGE;
}
/**
* Return the breeding probability of the rabbit.
* @return The breeding probability of the rabbit.
*/
protected double getBreedingProbability()
{
return BREEDING_PROBABILITY;
}
/**
* Return the maximal litter size of the rabbit.
* @return The maximal litter size of the rabbit.
*/
protected int getMaxLitterSize()
{
return MAX_LITTER_SIZE;
}
}
Actor class
import java.util.List;
/**
* Write a description of interface Actor here.
*
* @author (your name)
* @version (a version number or a date)
*/
public interface Actor
{
/**
* performs actor's regular behaviour
*/
void act(List<Actor> newActors);
/**
* is the actor still active
*/
boolean isActive();
}