Hello,
What I want to do is reset the pig's position to 0 and it's colour to pink. I don't how if I amended the the constructor correctly so the final line sends a resetCount() message to the newly created Animal object. The above code is not working because nothing happens. Pig object is sitting on position 0 with different colour. When I execute the code it should be on position 1, colour red then move to position 0, colour pink. All I want to know is how to use the reset method and if I should be using the loop.
Where am I going wrong?
Thanks in advance.
public class Farm
{
/* instance variable */
private Animal pig;
/*Constructor*/
public Amplifier(Pig aPig)
{
this.number.resetCount = 0;
}
public void resetCount()
{
while (this.pig.getPosition() > 1)
{
this.pig.setColour(Colour.ORANGE);
}
}
}