private void output() { for (Deal deal : deals) { System.out.println("Deal " + deal.getDate()); System.out.println( " " + deal.getBuyer().getName() + " buys from " + deal.getSeller().getName()); for (Entry<Product, Integer> entry : deal.getProducts().entrySet()) { Product product = entry.getKey(); int quantity = entry.getValue(); System.out.println( " " + product.getTitle() + " " + quantity + " x " + product.getPrice() + " = " + product.getCost(quantity)); } System.out.println("Sum: " + deal.getSum()); System.out.println("----------------------------"); outputParty(deal.getBuyer()); outputParty(deal.getSeller()); System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); } }
private Deal inputDeal() { System.out.println("Input deal ->"); System.out.print(" Seller -> "); Party seller = inputParty(); System.out.print(" Buyer -> "); Party buyer = inputParty(); Deal deal = new Deal(buyer, seller); boolean continueInput = true; do { Product product = inputProduct(); String quan = keyboard(" Quantity"); deal.getProducts().put(product, Integer.valueOf(quan)); continueInput = continueInputQuestion("Product"); } while (continueInput); return deal; }