Pizza.java
Created with JBuilder
/**
 * The best little pizza house in Texas.
 * A Pizza has a price and a shape.  A shape is that abstract entity that
 * intrinsically knows how to compute its own area.
 * A Pizza can tell you its price and its shape.
 * @author Dung X. Nguyen
 * @Copyright 2002 by Dung X. Nguyen - All rights reserved.
 */
public class Pizza {
    private double _price;
    private IShape _shape;

    /**
    * Initializes this Pizza to a given price and a given concrete shape.
    * @param price selling price, >= 0.
    * @param shape a concrete IShape, != null.
    */
    public Pizza(double p, IShape s) {
        _price = p;
        _shape  = s;
    }

    /**
    *  @return this Pizza's price in US$.
    */
    public double getPrice () {
        return _price;
    }

    /**
    * @return the shape of this Pizza..
    */
    public IShape getShape() {
        return _shape;
    }

    /**
     * Returns a String representation of this Pizza showing its price and its
     * shape.  For example, [$4.99, Rectangle(h= 4, w = 6)].
     */
    public String toString() {
        return null; // TO DO: STUDENT TO WRITE CODE
    }
}



Pizza.java
Created with JBuilder