|
|
7 yıl önce | |
|---|---|---|
| src | 7 yıl önce | |
| .gitignore | 7 yıl önce | |
| README.md | 7 yıl önce | |
| pom.xml | 7 yıl önce |
InventoryManager which interacts with a composite Inventory object by parsing incoming commands from a composite Console object.ProductProduct class.
id of type Long.price of type Double.quantity of type Integer.(Long, Double, Integer) used to set each of the respective fields.null value.ProductProductTest classInventoryInventory class.
productList of type List of Product objects.List of Product used to set the respective field.productList field to a new instance of ArrayList.add, which adds a Product to the compositeproductList.remove, which makes use of a Product product parameter to remove a Product from the compositeproductList.contains, which makes use of a Product product parameter to return true if the provided Product has been added to the productList field.findById which makes use of a Long id parameter to return a Product with the respective id from the productList field.removeById, which makes use of a Long id parameter to remove a Product with the respective id from the productList field.getTotalQuantity which returns the sum of the quantity fields of the Product objects in the productList field.getTotalValue which returns the product of the quantity and price field of each of the Product objects in the productList field.Inventoryinventory packageConsoleConsole class.
scanner of type Scanner.out of type PrintStream.(InputStream inputStream, PrintStream printStream) parameter to set the composite scanner and out fields.scanner field to a new Scanner which takes an argument of System.inout field to System.outprintln, which makes use of a String prompt parameter to print to the out field.getStringInput which makes use of a String prompt parameter to prompt the user for some input, then returns the input of the user as a string.getStringInput which makes use of a String prompt parameter to prompt the user for some input, then returns the input of the user as a string.getDoubleInput which makes use of a String prompt parameter to prompt the user for some input, then returns the input of the user as a double.getIntegerInput which makes use of a String prompt parameter to prompt the user for some input, then returns the input of the user as a integer.getLongInput which makes use of a String prompt parameter to prompt the user for some input, then returns the input of the user as a long.
ConsoleConsoleTest class
InventoryManagerInventoryManager class.
inventory of type Inventoryconsole of type Console(Inventory inventory, Console console parameters to set the inventory and console fields to the respective valuesinventory and console fields to nullary-constructed Inventory and nullary-constructed Console.getUserInput which prompts the user to input some variation of add, remove, view inventory, view product, or exit, then returns the input as a `String.add which makes use of user to input to construct a new Product and add it to the inventory field.remove which prompts a user to input an id and removes a Product with the respective id from the inventory field.viewProduct which prompts a user to input an id and displays details about a Product with the repspective id from the `inventory field.viewInventory which which displays the contents of the inventory.InventoryManagerInventory class