App05 Stock - Georgia04/BlueJ-Apps GitHub 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

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 (between 1 and 100)
  3. Sell a quantity of product (between 1 and 100)
  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 (between 1 and 5)
  7. Re-Stock Re-stock all the low stock items up to a set minimum level (between 1 and 10)
  8. Quit the application

Rename should have been added!

Program Design

UML: Use Case Diagram

UML: Use Case Diagram

UML: Class Diagram (10 marks)

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

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 = 255,
Name = "Apple iPhone 12 "
Product added The product is exists. Please choose another.
02 Add Product id = 261,
Name = "Camera"
Product added Name has been accepted.
03 Add Product id = 113,
Name = "Apple iPhone 11"
Product added
04 Add Product id = 114,
Name = "Apple iPhone 12"
Product added
05 Add Product id = 115,
Name = "Motorola G9 Plus"
Product added
06 Add Product
(duplicate ID)
id = 103,
name = "New Product"
Error Message
07 Add Product
(blank name)
id = 116,
name = ""
Error Message
08 Remove Product id = 262 Product removed
09 Remove Product
(invalid ID)
id = 203 Error Message
10 Print All Products Print Chosen 11 products listed 11 products listed
11 Deliver Product id = 256,
amount = 6
quantity = 6 quantity = 6
12 Deliver Product
(-ve amount)
id = 112,
amount = -4
Error Message
13 Sell Product id = 258,
amount = 2
quantity = 0 quantity = 0
14 Sell Product
(> stock)
id = 260,
amount = 5
quantity = 0 quantity = 0
15 Sell Product
(-ve quantity)
id = 112,
quantity = -2
Error Message
16 Search Product name = "Samsung" 1 Product Listed
17 Low Stock amount = 2 3 Products Listed

Rename should have been added, and rename with a blank name

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

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

Evaluation (10 Marks)

Imagine that Amazon were considering switching to use your java application, name the 5 most important features that you would need to add in order for it to be useable to Amazon

  • Feature 1
  • Feature 2
  • Feature 3
  • Feature 4
  • Feature 5
⚠️ **GitHub.com Fallback** ⚠️