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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.