package class6_3_ComputerBuilder; import java.util.*; public class Composite extends Component{ private String name; private double price; // any collection class could potentially work here private List components = new ArrayList(); public void add(Component c) { // just use the methods of the underlying collection class components.add(c); } public void remove (Component c){ components.remove(c); } Composite (String name) { this.name = name; this.price = 0; } Composite (String name, double basePrice) { this.name = name; this.price = basePrice; } public String getName() { return name; } /** * Get the price of this composite object by recursing * into all of it's constituent components (which could be either Parts * or additional Composites) */ public double getPrice() { double compositePrice = price; for(int i =0; i