public void modifyCD(int id, int price, String name, double capacity) { CompactDisk temp = (CompactDisk) compactDisks.get(id); temp.setPrice(price); temp.setName(name); temp.setCapacity(capacity); compactDisks.set(id, temp); }
public String printCD() { String result = "CD\nid\t\tprice\t\tname\t\tcapacity\n"; for (int i = 0; i < compactDisks.size(); i++) { CompactDisk temp = (CompactDisk) compactDisks.get(i); result = result + i + "\t\t" + temp.getPrice() + "\t\t" + temp.getName() + "\t\t" + temp.getCapacity() + "\n"; } return result; }