import java.util.*; /** * Write a description of class StockControl here. * * @author (your name) * @version (a version number or a date) */ public class StockControl { private ArrayList<Product> stockList = new ArrayList<Product>(); private ArrayList<Item> sales = new ArrayList<Item>(); public void addProductToStockList(String name, int stockLevel, int reorderLevel, int orderLevel){ stockList.add(new Product(String name,int stockLevel,int reorderLevel,int orderLevel)); } /** * Adds the item */ public void addSale(String name, int quantity) { sales.add(new Item(name, quantity)); } /** * Find a product. */ private Product findProduct(String name) { for (Product product: stockList) if (product.getName().equals(name)) return product; return null; } /** * DO the order */ public void orderProducts(){ for (Items item: sales){ Product product = findProduct(item.getName()); if (product == null){ System.out.println("Item" + item.getName() + "not recognised. Inform IT support."); return; } product.setStockLevel(product.getStockLevel() - item.getQuantity()); } String orders = ""; for (Product product: stockList){ if (product.getStockLevel() <= product.getReorderLevel()) orders = orders + product.getName() + " " + (product.getOrderLevel() - product.getStockLevel()) + "\n"; } System.out.println(orders); } }
The problem is appearing here:stockList.add(new Product(String name,int stockLevel,int reorderLevel,int orderLevel));
compilator writes next: ) expected