class Pizza {
	// static
	private static int numberCreated=0;
	private static double totalSales=0; 
	public static int getNumberCreated(){ return(numberCreated); }
	public static double getTotalSales(){ return(totalSales); }

	private static void addToSales(double price){
		totalSales=totalSales+price;
	}

	// instance
	private double price;
	private Shape shape; // A reference to anything that IS-A Shape
	private int numberOfPieces; 

	public int getNumberOfPieces(){ return(numberOfPieces); }

	public double getUnitCost(){
		double unitCost;
		// How do we know which getArea() method to call?
		// Java calls the one most closely associated with the
		// object.
		unitCost=price/shape.getArea();
		return(unitCost);
	}

	public int eat(){ return(eat(1)); }

	public int eat(int n){
		if(n>numberOfPieces)numberOfPieces=0;
		else numberOfPieces=numberOfPieces-n;
		return(numberOfPieces);
	}

	public Pizza(double p, Shape s, int np){
		price=p; shape=s; numberOfPieces=np;
		numberCreated=numberCreated+1;
		addToSales(price);
	}
}
