Class ShippingManifest

Object
ShippingManifest

public class ShippingManifest extends Object
This class is used as a list of products that are being shipped.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) int
    Indicates what zipcode we are currently at, used to stop Products from being forwarded, as they should be distributed when in their destination zipcode.
    (package private) ArrayList<Product>
    ArrayList that functions as our contained for Product objects.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a product the ArrayList instance object.
    void
    Used to "distribute" Product objects to their address instead of zip code.
    void
    forwardProducts(int destination)
    Used to "forward" Product objects to their destination.
    void
    Prints each Product objects toString().

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • productList

      ArrayList<Product> productList
      ArrayList that functions as our contained for Product objects.
    • currentLocation

      int currentLocation
      Indicates what zipcode we are currently at, used to stop Products from being forwarded, as they should be distributed when in their destination zipcode.
  • Constructor Details

    • ShippingManifest

      public ShippingManifest()
  • Method Details

    • addProduct

      public void addProduct(Product prod)
      Adds a product the ArrayList instance object.
      Parameters:
      prod - - A constructed Product object.
    • printManifest

      public void printManifest()
      Prints each Product objects toString(). If there are no items in the list, it is printed that the list is empty.
    • distributeProducts

      public void distributeProducts()
      Used to "distribute" Product objects to their address instead of zip code. In reality we are just removing the Product objects with a destination that is equal to the currentLocation variable.
    • forwardProducts

      public void forwardProducts(int destination)
      Used to "forward" Product objects to their destination. In reality we are just removing them from the productList.
      Parameters:
      destination -