   import java.text.NumberFormat;
/*****************************************************************
 * Item.java
 *
 * Represents an item in a shopping cart.
 ***************************************************************/
    public class Item
   {
   /** Name or description of the shopping cart item. **/
      private Produce 	thing;
   /** Number of this item in the shopping cart. **/
      private int    	quantity;
   
   /**********************************************************
    * Create a new item with the given attributes.
    * @param thing The produce type for this item
    * @param numPurchased The total number of the item purchased 
    **********************************************************/
       public Item (Produce thing, int numPurchased)
      {  
         this.thing = thing;      // make me
         this.quantity = numPurchased;
      }
   
   /*********************************************************
    * The description of the item in string format
    * @return The String representation of the item
    ********************************************************/
       public String toString ()
      {
         String builder;
         NumberFormat fmt;
      
         fmt = NumberFormat.getCurrencyInstance();
      
         builder = String.format("%-30s%10d%10s", thing.toString(), quantity, fmt.format(getItemCost()));
         return builder;
      
      }
   /******************************************************
    * Returns the unit price of the item.  Hint: Use Produce
    * @return Price of one item
    ******************************************************/
       public double getPrice()
      {
      // make me       return -1;
         return this.thing.getUnitPrice();
      // return thing.getUnitPrice();
      }
   /******************************************************
    * Returns the description of the item.  Hint: Use Produce
    * @return The name or description of the item
    ******************************************************/
       public String getName()
      {
      // make me       return "What is my name?";
      //return this.thing.getName();   //OK too
         return thing.getName();
      
      }
   /******************************************************
    * Returns the quantity of the item
    * @return Quantity of one item
    ******************************************************/
       public int getQuantity()
      {
      // make me       return -1;
      //return quantity;               //OK too
         return this.quantity;
      }
    /******************************************************
    * Returns the total cost of this item (uses the quantity and 
    * the produce unit cost). 
    * @return Cost of this of this item
    ******************************************************/
       public double getItemCost()
      {
      //    return -1;
      //return thing.getQuantity() * thing.getPrice();  // can't find symbols getPrice() or getQuantity() 
      	return this.getQuantity() * this.getPrice();  // OK too
      // return this.quantity * this.getPrice();     	// OK too
      // return quantity*thing.getUnitPrice(); 			// OK too
      
      }
   
   }