Part.java

package ProductConfig;
import java.io.PrintStream;

class NotACompositeException extends Exception {
    NotACompositeException() { super(); }
    NotACompositeException(String s) { super(s); }
}

public abstract class Part
{

public abstract double getPrice();

public abstract String getName();

public abstract String getDescription();

public abstract ResourceList getResourceList();

public abstract void displayInvoice(PrintStream stream, int level);

public abstract void addPart(Part part) throws
      NotACompositeException;

public abstract void removePart(Part part) throws
      NotACompositeException;;
}

Get Joy of Patterns: Using Patterns for Enterprise Development, The now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.