Package cs2110

Interface Item

All Known Implementing Classes:
BulkItem, SingleItem

public interface Item
Represents an (immutable) item that can purchased at a grocery store.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Return the cost of this Item, in cents.
    Return a description of this Item to be printed on a receipt.
    long
    Return a positive integer that identifies the product within the grocery store's point-of-sale system that this Item represents.
    Return the name of the product corresponding to this Item's code.
  • Method Details

    • cost

      int cost()
      Return the cost of this Item, in cents.
    • itemCode

      long itemCode()
      Return a positive integer that identifies the product within the grocery store's point-of-sale system that this Item represents. For example, this might be a (typically 4-5 digit) PLU code for produce/bulk items or a (12-digit) UPC code for packaged goods.
    • name

      String name()
      Return the name of the product corresponding to this Item's code.
    • formatForReceipt

      String formatForReceipt()
      Return a description of this Item to be printed on a receipt.