Leon 68faad888a updated readme | 6 anni fa | |
---|---|---|
.idea | 6 anni fa | |
src | 6 anni fa | |
.gitignore | 6 anni fa | |
README.md | 6 anni fa | |
pom.xml | 6 anni fa |
InventoryManager
which interacts with a composite Inventory
object by parsing incoming commands from a composite Console
object.Product
Product
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.Product
ProductTest
classInventory
Inventory
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.Inventory
inventory
packageConsole
Console
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.in
out
field to System.out
println
, 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.
Console
ConsoleTest
class
InventoryManager
InventoryManager
class.
inventory
of type Inventory
console
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.InventoryManager
Inventory
class