/* * This class models an item offered for sale at a grocery store. * A grocery item is basically the name of an item (String name) and * the price of an item in dollars (float price). Once created, * a grocery item cannot be changed. */ class GroceryItem { /* * Instance variables to store the name and price of a * grocery item. */ private String name; private float price; /* * This method is the constructor. Given the name and price, it * initializes the (newly created) object */ public GroceryItem(String name, float price) { this.name = name; this.price = price; } /* * This method returns the name of the item */ public String getName() { return name; } /* * This method returns the price of the item */ public float getPrice() { return price; } }