/** * GroceryItem Inlab. */ public class GroceryItem { private String name; //item name private double cost; //cost of 1 unit of item private int stock; // constructor for GroceryItems public GroceryItem(String inName, double inCost, int inStock) { name = inName; cost = inCost; stock = inStock; } // returns the item's name public String getName() { return name; } // returns the cost of 1 item public double getCost() { return cost; } public void decrementStock(int stockUsed) { stock -= stockUsed; } public void printStock() { System.out.println("There are "+stock+" units of "+name+" in stock"); } }