App 5 Stock - AtishAppadu/BlueJay Wiki

App05: Product Stock Application (with console based UI)

Students need to take a copy of this wiki page for their documentation, See Wiki Documentation which has a link to a video demonstration


This is the first BlueJ application that will offer a user interface so that the application can be run by a user without using the BlueJ Object Bench. It is based on the Stock Manager which contained a list of products that were being stocked and sold.

This application uses the StockManager and Product classes from App04 and adds a user interface class StockApp and a Program class which can be used to run the application without having to create any objects first.

The InputReader class is there to assist simple user input in the terminal window sometimes referred to as the console or command window.

Class Diagram


Feature Stage 1 - User Output

The application should be a standard Java Application with a Program class and a main() method which can be used without creating a Program object. The main() method in the Program class should create a StockApp which can print out a simple heading with the name of the application and the author name (you). It should look something like what is shown below

Program Heading
Most methods accesses by the user should include good, clear messages to the user (System.out.println), and any method should print out messages to the use that cover most of the simple mistakes a user could make. Marks will be deducted for unclear or incomplete messages to the user.

Features Stage 2 - User Menu

The first feature that is required by the user is to be offered a menu of choices. The user will enter their choice as a word, and in the first instance the menu can just offer the following choices:-

  1. Add a new Product to stock list
  2. Print all the products in stock
  3. Quit the application

Features Stage 3 - Additional Features

Once the basic menu is working then extend the menu to offer the following additional features. You may want to use the StockDemo class to add more products to the stock to make testing easier.

  1. Remove a product from stock list
  2. Deliver a quantity of product
  3. Sell a quantity of product
  4. Print all the products in stock
  5. Search and print a list of products based on part of the product name
  6. Low Stock print a list of products whose stock levels are low
  7. Re-Stock Re-stock all the low stock items up to a set minimum level
  8. Quit the application

Program Design

UML: Use Case Diagram

UML: Use Case Diagram

UML: Class Diagram (10 marks)

I have investigated the different Java IDEs (Integrated Development Environments) as some of them support UML, and in particular JDeveloper by Oracle can be used to easily create a full class diagram (see below). JDeveloper also can create use case, sequence and activity diagrams. It is also free.

Best Java IDEs for 2020

BlueJ Extensions

Please watch this short video (10 mins) on how to extend BlueJ so that it can produce a more detailed Class diagram, however it is difficult to product and has no ability to show the relationships between the classes. The multi-project workspace extension, is in my view worth installing and I use it all the time. Similarly adding getter/setters automatically is worth using.
Installing BlueJ Extensions Video

Visual Paradigm

Visual Paradigm is a full CASE (Computer Aided Software Engineering) tool that can generate code from diagrams and diagrams from code. Only the Standard Edition and above can create a class diagram from java code. So you can use that by downloading and installing the 1 month free trial edition.

Please watch this video How to Create Class and Use Case Diagrams using Visual Paradigm

The student must replace this UML diagram with their own class diagram!

UML: Class Diagram


Black Box Testing (10 marks)

The student must complete the following black box tests. The actual product and id can be changed

Test No Proposed Test Data Entered Expected Result Actual Result Comments
01 Add Product id = 111, Name = "Razer Ornata" Product added Product has been added Function works as expected however there are no indicators whether a product has been added example "Product has been added"
02 Add Product id = 112, Name = "Razer BlackWidow Keyboard" Product added Product has been added When entering a ID number such as 155, an error comes up however when using an ID such as 112/113/114 it works as it should be.
03 Add Product id = 113, Name = "Razer Tournament Keyboard" Product added Product has been added Works as expected although same issues persist as Task 1 for add product
04 Add Product id = 114, Name = "Razer Mini Huntsman Keyboard" Product added Product has been added Works as expected although same issues persist as Task 1 for add product
05 Add Product id = 120, Name = "Razer Siren Mic" Product added Product Has been added Works as expected although same issues persist as Task 1 for add product
06 Add Product(duplicate ID) id = 101, name = "New Product" Error Message
07 Add Product(blank name) id = 111, name = "" Error Message
08 Remove Product id = 101 Product is removed Product removed The remove function works as expected
09 Remove Product(invalid ID) id = 203 Error Message No error Message appeared
10 Print All Products Print Chosen 10 products listed All products has been listed
11 Deliver Product id = 101, amount = 5 quantity = 5 Items Delivered Function works fine
12 Deliver Product(-ve amount) id = 102,amount = -4 Error Message Doesn't Show error message It doesn't add to the stock however there are no error message
13 Sell Product id = 101, amount = 4 quantity = 10 Works Fine There is not message that shows whether an Item has been sold
14 Sell Product(> stock) id = 112, amount = 10 quantity = 0 Works fine There is not message that shows whether an Item has been sold
15 Sell Product(-ve quantity) id = 112, quantity = -2 Error Message function works as expected There are no error messages
16 Search Product name = "Razer" 1 Product Listed Product has not been listed Error in coding, the function does not allow the listed products to be printed
17 Low Stock amount = 2 3 Products Listed No products has been listed Error in code, doesn't allow the products to be listed

The student must provide a link to a text file recording (or recordings) of this testing from a terminal window

Tests 1 to 11.txt
Tests 12 to 17.txt

Evaluation (10 Marks)