/*
   This class defines the OrderItem data type.

   This is an abstract class. Since there is nothing
   in this class that defines the kind of item that was
   ordered, this class should not be instantiated. A
   class that extends this class should specialize the
   kind of item ordered.
*/

public abstract class OrderItem
{
   // every OrderItem should specify the price of the item
   // and the quantity ordered of the item
   private double price;
   private int quantity;

   // default constructor
   public OrderItem()
   {
      this(0, 0);
   }

   // a partial constructor
   public OrderItem(double price)
   {
      this(1, price);
   }

   // a full constructor
   public OrderItem(int quantity, double price)
   {
      setQuantity(quantity);
      setPrice(price);
   }

   public void setPrice(double price)
   {
      this.price = price;
   }

   public void setQuantity(int quantity)
   {
      this.quantity = quantity;
   }

   public double getPrice()
   {
      return price;
   }

   public int getQuantity()
   {
      return quantity;
   }

   public String toString()
   {
      return "The quantity ordered of this item is: " + getQuantity() + "\n"
           + "and the price per item is $" + getPrice() + ".";
   }

}//OrderItem