Product.java.html

  1  /**
  2     Describes a product with a description and a price.
  3  */
  4  public class Product
  5  {  
  6     private String description;
  7     private double price;
  8  
  9     /**
 10        Constructs a product from a description and a price.
 11        @param aDescription the product description
 12        @param aPrice the product price
 13     */
 14     public Product(String aDescription, double aPrice)
 15     {  
 16        description = aDescription;
 17        price = aPrice;
 18     }
 19     
 20     /**
 21        Gets the product description.
 22        @return the description
 23     */
 24     public String getDescription()
 25     {  
 26        return description;
 27     }
 28  
 29     /**
 30        Gets the product price.
 31        @return the unit price
 32     */
 33     public double getPrice()
 34     {
 35        return price;
 36     }
 37  }
 38