App05: Stock App - BNU-Comp-Louis/BlueJ-PartA GitHub Wiki

App05: Product Stock Application (with console based UI)

Description

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

Requirements

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)

UML: Class Diagram

Testing

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 = 115,
Name = "iPhone XS Max"
Product added You have added 115: iPhone XS Max stock level: 0 N/A
02 Add Product id = 116,
Name = "NZXT Watercooler"
Product added You have added 116: NZXT watercooler stock level: 0 N/A
03 Add Product id = 117,
Name = "Corsair 16gb Ram DDR4"
Product added You have added 117: Corsair 16gb Ram DDR4 stock level: 0 N/A
04 Add Product id = 118,
Name = "Razer Mouse"
Product added You have added 118: Razer Mouse stock level: 0 N/A
05 Add Product id = 119,
Name = "Benq Monitor"
Product added You have added 119: Benq Monitor stock level: 0 N/A
06 Add Product
(duplicate ID)
id = 100,
name = "Sony Playstation"
Error Message This Product ID already Exists N/A
07 Add Product
(blank name)
id = 116,
name = ""
Error Message Need to add a method to preform this check
08 Remove Product id = 100 Product removed This Product has been removed N/A
09 Remove Product
(invalid ID)
id = 200 Error Message Method works need to adjust the printline for user
10 Print All Products Print Chosen All Products listed 12 Products Listed N/A
11 Deliver Product id = 111,
amount = 5
quantity = 5 Product delivered :111: Sony Tv stock level: 5 N/A
12 Deliver Product
(-ve amount)
id = 102,
amount = -5
Error Message Attempt to restock Razer Mobile
with a non-positive amount: -5
N/A
13 Sell Product id = 100,
amount = 2
quantity = 5 100: Samsung Mobile stock level: 4
Sold 2 of Samsung Mobile
N/A
14 Sell Product
(> stock)
id = 100,
amount = 5
quantity = 4 Attempt to sell an out of stock item:
In Stock 4 Ordered Amount : 5
We only have : 4 Currently in Stock
N/A
15 Sell Product
(-ve quantity)
id = 100,
quantity = -2
Error Message 100: Samsung Mobile stock level: 4
The amount cannot be negative number
N/A
16 Search Product name = "Apple" 3 Product Listed 101: Apple Mobile stock level: 0
104: Apple Mac stock level: 0
110: Apple iPad stock level: 0
N/A
17 Low Stock amount = 2 10 Products Listed 101: Apple Mobile stock level: 0
102: Razer Mobile stock level: 0
103: Samsung Tv stock level: 0
104: Apple Mac stock level: 0
105: Xbox stock level: 0
107: Alienware Laptop stock level: 0
108: LG Mobile stock level: 0
109: LG Tv stock level: 0
110: Apple iPad stock level: 0
111: Sony Tv stock level: 0
N/A

Links to Testing files

Tests 1 to 7.txt
Tests 8 to 17.txt

Evaluation (10 Marks)

Improvements to Application

  • Be able to add more than one item to a sale, (Basket Class)
  • If more than One item is able to be added, function to remove or total basket.
  • Search Function for both Name and ID
  • Price for Products
  • Transaction system able to imitate till procedures, Sell, change, refund etc.
  • ⚠️ **GitHub.com Fallback** ⚠️