(a) The UML Diagram for the GroceryItem class. +--------------------------------------------------------+ | GroceryItem | +--------------------------------------------------------+ | - code : int | | - name : String | | - price : double | | - quantity : int | +--------------------------------------------------------+ | + GroceryItem(c : int, n : String, p : double, q : int)| | + getCode() : int | | + getName() : int | | + getPrice() : int | | + setPrice(p : int) | | + toString() : String | +--------------------------------------------------------+ (b) The GroceryItem class. public class GroceryItem { public int code; public String name; public double price; public int quantity; public GroceryItem(int c, String n, double p, int q) { code = c; name = n; price = p; quantity = q; } public double getPrice() { return price; } public void setPrice(double p) { if (p > 0.00) price = p; } public String toString() { return code + " " + name + " " + price + " " + quantity; } } //(c) The main class to test the GroceryItem class. public class Main { public static void main(String[] args) { GroceryItem x = new GroceryItem(3542534, "Milk", 2.79, 2); System.out.println(x); System.out.println(x.getPrice()); x.setPrice(2.99); System.out.println(x); } } //(d) Here is the output: 3542534 Milk 2.79 2 2.79 3542534 Milk 2.99 2