Unnamed Package


  • Class
    Description
    (The Basic Products) These classes extend Item Snack adds a specific boolean property to check if it's vegan, while Beverage adds a boolean to check if it is cold They both override displayDetails() to print their specific information
    Exception that is thrown when item is expired Extends exception
    Exception that is thrown when payment is insufficient Extends exception
    InventorySlot<T extends Item>
    (The Container) This is a Generic class Instead of storing just items, the vending machine stores InventorySlot objects This class holds the actual item (like a Snack) and the quantity of that item remaining in the machine
    (The Blueprint) This is the abstract base class It defines the universal properties every product has (a name and a price) and forces all child classes to create their own version of a displayDetails() method
    (The User Interface) This contains the public static void main method It is responsible for the infinite while loop that keeps the program running, asking the user for input via Scanner, and catching any errors if the user does something wrong
    Exception that is thrown when item is out of stock Extends exception
    (The Advanced Product) This class extends Snack It introduces a java.util.Date property for an expiration date It overrides the isExpired() method from the base class to check if today's date is past the item's expiration date
    (The Basic Products) These classes extend Item Snack adds a specific boolean property to check if it's vegan, while Beverage adds a boolean to check if it is cold They both override displayDetails() to print their specific information
    (The Brain) This is the core engine It reads the inventory.txt file, stores the items in a HashMap, processes the user's money, dispenses the item, reduces the stock, and generates the receipt