import java.text.NumberFormat;
/*****************************************************************
 * Produce.java
 *
 * Represents the available produce items 
 ***************************************************************/
public enum Produce
{
	APPLE 	(.99, 4153, "Macintosh Apple"),
	GRAPE		(1.89, 4022, "Green Seedless Grapes"),
	KUMQUAT	(1.99, 4303, "Kumquats"),
	TURBAN	(2.99, 7980, "Turban Squash"),
	YUCCA		(3.99, 4819, "Yucca Root"),
	RHUBARB	(1.29, 4745, "Rhubarb"),
	HABANERO	(.89, 3125, "Habanero Peppers"),
	CHERRY	(4.99, 4045, "Cherries"),
	PASSION	(2.59, 3311, "Passion Fruit"), 
	BREAD		(1.59, 4254, "Breadfruit"),
	CUKE		(.89, 4062, "Dukes Cuke");
	
   /** Price of the produce item. **/
	private double price;
   /** PLU code of this produce item. **/
   private int    plu;
	/** Description of this produce item. **/
	private String description;
	
   /**********************************************************
    * Create a new Produce item with the given attributes.
    *
	 * @param price 	The price of the item
	 * @param plu 	  	Price lookup (PLU) code for this item
	 * @param description Description of this item
	 **********************************************************/
   private Produce (double price, int plu, String description)
   {  
         this.price = price;
			this.plu = plu;
			this.description = description;
   }

   /*********************************************************
    * The description of the produce item in string format
    * @return The String representation of this produce
    ********************************************************/
   public String toString ()
   {
      NumberFormat fmt; 
      String builder;   // use to make nice columns
		    
      fmt = NumberFormat.getCurrencyInstance();
  
      if (this.description.length() > 20)
         builder = this.description.substring(0,20); // pull off 20 chars
      else if (this.description.length() == 20)
         builder = this.description;
      else
      {
         builder = this.description;
         for (int ii = 1; ii <= 20 - this.description.length(); ii++)
            builder = builder + " "; // pad with blank 
      }
		
		// now add in the price
		builder = builder + " " + fmt.format(price);
			 
		return builder;
	}
   /******************************************************
    * Returns the unit price of the item
    * @return Price of one item
    ******************************************************/
   public double getUnitPrice()
   {
      // make me      return -1;
		return this.price;
   }
   /******************************************************
    * Returns the plu code of the item
    * @return The plu code of the item
    ******************************************************/
   public int getPlu()
   {
      // make me      return -1;
		return this.plu;
   }
	
	 /******************************************************
    * Returns the description of the item
    * @return The name (description) of the item
    ******************************************************/
   public String getName()
   {
      // make me       return "What is my name?";
		return this.description;
   }

}