package domain.product; import java.util.ArrayList; import java.util.Collection; public class JointProduct extends Product { public float discountPercentage; public Collection Products = new ArrayList(); public JointProduct(String name, float discountPercentage){ super(name); super.name = name; super.price = 0; this.discountPercentage = discountPercentage; } /*public JointProduct(String name, float discountPercentage,Collection products){ }*/ public void addProduct(Product product){ if(product != null){ Products.add(product); } } public boolean removeProduct(Product product){ if(product != null){ Products.remove(product); return true; } else{ return false; } } /*public Collection getProducts(){ }*/ public float getPrice(){ return this.getPrice(); } public String toString(){ return "JointProduct [name="+this.name+",price="+this.price+",discountPercentage="+this.discountPercentage+"]"; } @Override public JointProduct deepCopy() { // TODO Auto-generated method stub JointProduct Copy = new JointProduct("name",0); Copy.name = this.name; Copy.price = this.price; Copy.discountPercentage = this.discountPercentage; return Copy; } }