/**
 * Represents a Farm (poorly).  Primarly used to demonstrate pass by value
 * @author CSCI209
 */
public class Farm2 {

    private String name;

    public Farm2(String name) {
        this.name = name;
    }

    /**
     * c copies the value of the variable passed into the method.
     * When c is then assigned to a _new_ Chicken object, c now refers to 
     * a new address.  The original variable passed in does not change,
     * so updates to the new Chicken object do not affect the original 
     * Chicken object passed in.
     */
    public void feedChicken(Chicken c) {
        c = new Chicken(c.getName(), c.getWeight(),
                        c.getHeight() );
        c.setWeight( c.getWeight() + .5);
    }

    public static void main(String[] args) {
        Farm2 farm = new Farm2("OldMac");
        Chicken sal = new Chicken("Sallie Mae", 5, 23.2);
        System.out.println(sal.getWeight());
        farm.feedChicken(sal);
        // sal is not affected
        System.out.println(sal.getWeight());
    }

}