public synchronized double getTotal() { double amount = 0.0; for (Iterator i = getItems().iterator(); i.hasNext(); ) { ShoppingCartItem item = (ShoppingCartItem) i.next(); BookDetails bookDetails = (BookDetails) item.getItem(); amount += (item.getQuantity() * bookDetails.getPrice()); } return roundOff(amount); }