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 {
    /**
     * The price of this pizza.
     */
    private double _price;

    /**
     * The shape of this pizza.
     */
    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 the Pizza's price in US$.
     * @return this Pizza's price in US$.
     */
    public double getPrice () {
        return _price;
    }

    /**
     * Return the shape of this pizza.
     * @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)].
     * @return string representation of this pizza.
     */
    public String toString() {
        return null; // TO DO: STUDENT TO WRITE CODE
    }
}



Pizza.java
Created with JBuilder