//=================================================================================================
public class Apple implements ProvidesValue {
//-------------------------------------------------------------------------------------------------
    private static final int PERCENTAGE_BITE = 10;
//-------------------------------------------------------------------------------------------------
    private double weight;
    private double biteWeight;
//-------------------------------------------------------------------------------------------------
    public Apple() {

        this(DEFAULT_WEIGHT);
    }
//-------------------------------------------------------------------------------------------------
    public Apple(double weight) {

        this.weight = weight;
        biteWeight = weight * PERCENTAGE_BITE/100.0;
    }
//-------------------------------------------------------------------------------------------------
    public String toString() {

        return("I'm an apple and I weigh " + weight);
    }
//-------------------------------------------------------------------------------------------------
    public double getValue() {

        return(weight);
    }
//-------------------------------------------------------------------------------------------------
    public void eatSome() {

        if (weight >= biteWeight) {
            weight -= biteWeight;
        } else {
            weight = 0.0;
        }
    }
//-------------------------------------------------------------------------------------------------
}
//=================================================================================================
