import java.text.NumberFormat;

public class Product
{
      // the instance variables
      private String code;
      private String description;
      private double price;

      // the constructor
      public Product()
      {
             code = "";
             description = "";
             price = 0;
      }
      
      // the set and get accessors for the code variables
      public void setCode(String code)
      {
             this.code = code;
      }
      public String getCode()
      {
             return code;
      }
      
      // this set and get accessories for the description variables
      public void setDescription(String description)
      {
             this.description = description;
      }
      pubic String getDescription()
      {
             return description;
      }

      // this set and get accessories for the price variables 
      public void setPrice(double price)
      {
             this.price = price;
      }
      public double getPrice()
      {
             return price;
      }

      // a custom get accessor for the price variable
      public String getFormattedPrice()
      {
             NumberFormat currency = NumberFormat.getCurrencyInstance();
             return currency.format(price);
      }
}   






Site hosted by Angelfire.com: Build your free website today!