Class ShippingManifest
Object
ShippingManifest
This class is used as a list of products that are being shipped.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) intIndicates what zipcode we are currently at, used to stop Products from being forwarded, as they should be distributed when in their destination zipcode.ArrayList that functions as our contained for Product objects. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProduct(Product prod) Adds a product the ArrayList instance object.voidUsed to "distribute" Product objects to their address instead of zip code.voidforwardProducts(int destination) Used to "forward" Product objects to their destination.voidPrints each Product objects toString().
-
Field Details
-
productList
ArrayList that functions as our contained for Product objects. -
currentLocation
int currentLocationIndicates 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
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-
-