123456789101112131415161718192021222324252627282930 |
-
- /**
- * Write a description of class Inventory here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class Inventory
- {
- private Product[] product;
- private double inventoryValue = 0;
-
- public Inventory(Product[] product){
- this.product = product;
- }
-
- public double getWholeInventoryValue(Product[] product){
- for (Product element : product){
- inventoryValue += (getValueOfAProduct(element));
- }
- return inventoryValue;
- }
-
- public double getValueOfAProduct(Product product){
- double price = product.getPrice();
- int quantity = product.getQuantity();
- return price*quantity;
- }
- }
|