I am a new programmer in grade 11 using greenfoot, I started by using Scratch and did ok in it but now that we have advanced to greenfoot I am doing really bad. I need help in my homework which is to: Create a Chicken and make it fly left and right by changing the argument to the fly(int) method.
2. Create a Chicken and modify its name by invoking the setName(String) method. Put double
quotations around the argument.
Heres the code:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class Chicken extends Actor
{
private String name;
public void act()
{
move(1);
}
public void fly(int distance)
{
move(distance);
}
public void setName(String newName)
{
name = newName;
}
}