import java.util.ArrayList; public class StoreManager { /** * returns the name of an item whose unit price is the lowest * in the specified category; if no items in the specified * category, returns "none" */ public String minUnitPrice(GroceryStore store, String category) { ArrayList list = store.getAllItems(category); if (list.size() == 0) { return "none"; } GroceryItem minItem = (GroceryItem) list.get(0); for(int k=1; k < list.size(); k++) { GroceryItem current = (GroceryItem) list.get(k); if (current.getPrice()/current.getSize() < minItem.getPrice()/minItem.getSize()) { minItem = current; } } return minItem.getName(); } }