123456789101112131415161718192021222324252627282930313233 |
-
- /**
- * Write a description of class Manager here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class Manager
- {
- Console aConsole = new Console();
- Inventory inventory = new Inventory();
- Product aProduct;
-
- public void createInventory(){
- int numberOfProducts = aConsole.userSetNumberOfProducts();
- for (int i = 0; i < numberOfProducts; i++){
- inventory.addProductToInventory(aProduct = new Product(aConsole.userSetName(),
- aConsole.userSetPrice(), aConsole.userSetID(), aConsole.userSetQuantity()));
- }
- }
-
- public void recordInventory(){
- Product[] allProducts = inventory.getInventory();
- System.out.println("Products in inventory: ");
- for (Product p : allProducts){
- System.out.println("#" + p.getID() + " " + p.getName() + " $" +
- p.getPrice() + " " + p.getQuantity() + "qty");
- }
- double sumOfValue = inventory.sumInventoryValue();
- System.out.println("The value of all inventory is: $" + sumOfValue);
- }
- }
|