import java.awt.Color;
/**
 * Class to describe a fruit.
 */
public class Fruit
   {
   /**
    * Flavour of the fruit.
    */
   private String flavour;

   /**
    * Colour of the fruit.
    */
   private Color colour;

   /**
    * Compare this Fruit object with another
    * fruit object.
    *
    * @param other Object, usually a Fruit, to compare with.
    *
    * @return true if the objects are of identical flavour.
    */
   public boolean equals ( Object other )
      {
      if ( other == null )
         {
         return false;
         }
      else if ( other instanceof Fruit )
         {
         return this.flavour.equals ( ((Fruit)other ).flavour );
         }
      else return false;
      }

   /**
    * Calculate the hashcode of this object, based
    * only on its flavour.
    *
    * @return the hashcode for the Fruit object
    */
   public int hashCode()
      {
      return flavour.hashCode();
      }
   }