123456789101112131415161718192021222324252627 |
- import java.util.*;
-
- public class Inventory{
- private List<Product> products;
-
- public Inventory(){
- products = new ArrayList();
- }
-
- public void add(Product product){
- products.add(product);
- }
-
- public List<Product> getProducts(){
-
- return products;
- }
-
- public int getTotalQuantity(){
- int total = 0;
- for(Product p : products){
- total = total + p.getQuantityOfItem();
- }
- return total;
- }
- }
|