public double calculateDeliveryCost(){ //instance varibles double deliveryCost = 0; double aleCost=0; Ale ale; Iterator itr = products.iterator(); Product product; //go through order and check is product is an ale while (itr.hasNext()) { product = (Product) itr.next(); //if product is an ale add to ales list if(product.getClass().toString().equals("class Ale")) { aleCost += product.getPrice(); } deliveryCost += 2; } if(aleCost >= 50){ deliveryCost = 0.00; } return deliveryCost; }