previous | start | next

Example: Printing an Invoice - Method Documentation

/**
   Describes an invoice for a set of purchased products.
*/
class Invoice
{
   /**
      Adds a charge for a product to this invoice.
      @param aProduct the product that the customer ordered
      @param quantity the quantity of the product
   */
   public void add(Product aProduct, int quantity)
   {
   }

   /**
      Formats the invoice.
      @return the formatted invoice
   */
   public String format()
   {
   }

   /**
      Computes the total amount due.
      @Return the amount due
   */
   public double getAmountDue()
   {
   }
}



/**
   Describes a quantity an article to purchase and its price.
*/
Class Item
{
   /**
      Computes the total cost of this item.
      @Return the total price
   */
   public double getTotalPrice()
   {
   }

   /**
      Formats this item.
      @Return a formatted string of this item
   */
    public String format()
    {
    }
 }
/**
   Describes a product with a description and a price
*/
class Product
{
   /**
      Gets the product description.
      @Return the description
   */
   public String getDescription()
   {
   }

   /**
      Gets the product price.
      @Return the unit price
   */
   public double getPrice()
   {
   }
}



/**
   Describes a mailing address.
*/
Class Address
{
   /**
      Formats the address.
      @Return the address as a string with 3 lines
   */
   public String format()
   {
   }
}



previous | start | next