import java.io.*;

public abstract class CatalogItem
  implements Serializable {

  private double price;
  private int quantity;

  public CatalogItem(double inPrice, int inQuantity) {
    price = inPrice;
    quantity = inQuantity;
  }

  public double getPrice() {
    return price;
  }

  public int checkQuantity() {
    return quantity;
  }

  public void decrementQuantity() 
    throws Exception {

      if(quantity <= 0) {
        throw new Exception("Not enough in Inventory to decrement");
      }
      quantity--;
  }

  public void decrementQuantity(int amount) 
    throws Exception {

      if(checkQuantity() < amount) {
        throw new Exception("Not enough in Inventory to decrement");
      } else {
        quantity -= amount;
      }
  }

  public void incrementQuantity(int amount) {
    quantity += amount;
  }
}
