Leon 90e057dd2a removed ignored files 5 years ago
src updated readme 5 years ago
.gitignore removed ignored files 5 years ago
README.md updated readme 5 years ago
pom.xml first commit 5 years ago

README.md

Product Inventory Project

  • Objective - to implement an InventoryManager which interacts with a composite Inventory object by parsing incoming commands from a composite Console object.
  • Purpose - to demonstrate understanding of
    • objects and functions
    • controlling execution
    • access control
    • reusing classes

Part 1.0 - Create class Product

  • Create a Product class.
    • declare a field named id of type Long.
    • declare a field named price of type Double.
    • declare a field named quantity of type Integer.
    • define a constructor, which has paramters of type (Long, Double, Integer) used to set each of the respective fields.
    • define a nullary constructor, which sets each field to a null value.
    • define getters and setters for each of the fields

Part 1.1 - Test Product

  • Ensure 100% test-success in the ProductTest class

Part 2.0 - Create class Inventory

  • Create an Inventory class.
    • declare a field named productList of type List of Product objects.
    • define a constructor, which has a paramter of type List of Product used to set the respective field.
    • define a nullary constructor, which sets the productList field to a new instance of ArrayList.
    • define method named add, which adds a Product to the compositeproductList.
    • define method named remove, which makes use of a Product product parameter to remove a Product from the compositeproductList.
    • define method named contains, which makes use of a Product product parameter to return true if the provided Product has been added to the productList field.
    • define method named findById which makes use of a Long id parameter to return a Product with the respective id from the productList field.
    • define method named removeById, which makes use of a Long id parameter to remove a Product with the respective id from the productList field.
    • define method named getTotalQuantity which returns the sum of the quantity fields of the Product objects in the productList field.
    • define method named getTotalValue which returns the product of the quantity and price field of each of the Product objects in the productList field.
    • define getters and setters for each of the fields

Part 2.1 - Test Inventory

  • Ensure 100% test-success in each of the classes in the inventory package

Part 3.0 - Create class Console

  • Create a Console class.
    • declare a field named scanner of type Scanner.
    • declare a field named out of type PrintStream.
    • define a constructor which makes use of a (InputStream inputStream, PrintStream printStream) parameter to set the composite scanner and out fields.
    • define a nullary constructor, which
      • sets the scanner field to a new Scanner which takes an argument of System.in
      • sets the out field to System.out
    • define a method named println, which makes use of a String prompt parameter to print to the out field.
    • define a method named 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.
    • define a method named 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.
    • define a method named 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.
    • define a method named 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.
    • define a method named 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.

Part 3.1 - Test Console

  • Ensure 100% test-success ConsoleTest class

Part 4.0 - Create class InventoryManager

  • Create an InventoryManager class.
    • declare a field named inventory of type Inventory
    • declare a field named console of type Console
    • define a constructor which makes use of a (Inventory inventory, Console console parameters to set the inventory and console fields to the respective values
    • define a nullary constructor, which initializes the inventory and console fields to nullary-constructed Inventory and nullary-constructed Console.
    • define a method named 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.
    • define a method named add which makes use of user to input to construct a new Product and add it to the inventory field.
    • define a method named remove which prompts a user to input an id and removes a Product with the respective id from the inventory field.
    • define a method named viewProduct which prompts a user to input an id and displays details about a Product with the repspective id from the `inventory field.
    • define a method named viewInventory which which displays the contents of the inventory.
    • define getters and setters for each of the fields.

Part 4.1 - Test InventoryManager

  • Ensure 100% test-success Inventory class

Frequently Asked Questions

  • May I modify the test cases?
    • uhm, no.
  • May I write my own test cases?
    • absolutely
  • Must I write my own tests?
    • No, but additional test-cases wouldn't hurt.
  • Why have some methods been broken into entirely new test classes?
    • To ensure that more test cases can be written around each method in the future.