INTRODUCTION

In your role as a software developer, you have been contracted by QUB’s Automated Retail Department to create a Java application to manage the core behaviour of a vending machine, enabling a customer to purchase a range of items. Specifically, you are required to build and test a prototype system that meets the deliverables outlined in the sections below.

PART 1: CORE FUNCTIONALITY (50 MARKS AVAILABLE)

In order to demonstrate that the proposed Java application is feasible, the following features must be implemented.

1. Implementation of the object classes, enumerator class and interface shown in Figure 1 below.

Figure 1: A (partial) UML Class Diagram for QUB Automated Retail Department Vending Machine Control Software.
2. A console (menu-based) application to manage customer purchases of items from a vending machine. The following features should be provided:
A user should be able to view items available for purchase (and quantity available)
A user should be able to (repeatedly) enter a coin – limited to 5p, 10p, 20p, 50p, £1 and £2 denominations.
A user should be able to view the value of coins entered
A user should be able to select an item and make a purchase
A user should be able to view the results of a purchase request:
    • o Success – machine is in VENDING_MODE, selected item is available and enough money has been entered to cover the cost; if change is due this should be given/reported
    • o Failure – machine is in SERVICE_MODE, selected item out of stock or not enough cash entered to cover cost of item required
3. Provide an option to quit the application.

Notes:

- The application should initialise the machine with a range of VendItem objects (using addNewItem).
- The VendingMachine constructor parameters specify the owner (String) and maximum number of items (VendItem) for sale
- The instance variable itemCount defines the actual number of items (VendItem) for sale
- The instance variable stock is an Array
- The instance variable totalMoney represents the total amount of cash in the machine
- The instance variable userMoney represents the money entered by a user for a purchase
- The method getSystemInfo() should return a formatted string containing all details related to a VendingMachine instance
- The method reset() should reinitialise a VendingMachine instance:- empty of items and cash
- The method listItems() should return an array of strings, containing the names of each item for sale.
- The method purchaseItem() should enable a user to request purchase of a specified item:
  • the int parameter represents the index of the VendItem in the stock array
  • if a purchase request is approved, the deliver() method for a VendItem object should be called and should return a string specific to the item name, in line with: “Thanks for purchasing: (or null if not available). This should be integrated with the result of purchaseItem().
  • if the last item in the machine is purchased, the machine state should be set to SERVICE_MODE.
- The constructor for VendItem should be overloaded to allow specification of item name and cost or name, cost and quantity available. Cost should be multiples of 5p and up to a maximum of £2. The maximum quantity for any item should be 10.
- The itemId instance variable for a VendItem object should be uniquely assigned
- The restock() method for VendItem should update the quantity of an item
- The decrement() method for VendItem should reduce available quantity of an item by 1 (as appropriate)
- Public method signatures may not be modified – you can add private helper methods/data as required (but must be justified in comments)
- You may make use of the Menu class defined in Menu.java

PART 2: ADDITIONAL FEATURES (30 MARKS AVAILABLE)

Further to the features outlined above, QUB’s Automated Retail Department is interested in evaluating any additional functionality that may be of benefit to the application. Accordingly, within the time and resource constraints of the project, you have been asked to investigate and (where possible) implement additional functionality:
2.1 Add a (hidden) menu option to the main application that will enable a user (engineer) to access a (password protected) maintenance menu. This menu should provide the following options:
view all data related to the vending machine, appropriately formatted
reset the machine to factory default (empty of money & items)
switch status between VENDING_MODE and SERVICE_MODE
a facility to add a new VendItem or to restock an existing item
2.2 Add instance data to the VendingMachine class to keep track of coin denominations it contains (in addition to their total value), reporting on change given for purchases in terms of coin combinations as well as total value. If change can’t be delivered (due to coin availability), this should be reported.
2.2 Add behaviour to the system to enable the state of a VendingMachine to be stored/retrieved to/from a (CSV) file. This should be restored when the application starts and stored when the application is exited.
NOTE:
Each piece of additional functionality in line with those described above will be awarded marks based on the quality of the functionality provided.
Use of serialization for storing/retrieving data is not permitted – the required mechanism will be covered in the lectures.
To help QUB review any additional features implemented, include a short Microsoft Word document with your submission that provides a title and short description (max 2-3 sentences) for each feature.
NOTE: Part 1 and Part 2 should be submitted as separate packages as described in the general instructions.

PART 3: TESTING AND DEMONSTRATING THE APPLICATION (20 MARKS)

As part of QUBs quality assurance procedure, you are required to submit evidence that the application has been thoroughly tested. This should take the form of a completed testing document. The scope of this testing should cover all areas of core functionality outlined in Part 1 of this assignment specification. Please note that any testing documentation submitted for

Part 2 will not accrue any additional marks. Additionally, testing documentation must be submitted using the template provided by QUB.

You will be required to briefly demonstrate your work for Part 1 and Part 2 during the lab session on Thursday 26th March 2020.

GENERAL INSTRUCTIONS
CODE IMPLEMENTATION
1. Create a new Java project named ‘Assessment2’.
2. Add two packages to ‘Assessment2’ named ‘part01’ and ‘part02’ respectively.
3. Implement your code as described below:
‘part01’ should contain all code associated with the core requirements.
‘part02’ should contain all code associated with the core requirements AND the code for any additional features you have implemented.

TESTING DOCUMENTATION

Ensure that the testing is documented using the template provided.

SUBMISSION INSTRUCTIONS

1. Create a new folder to hold all your assignment files for submission. The folder should be suitably named and include your student number.

2. Copy and paste the ‘part01’ and ‘part02’ folders from your java project into the folder created in step 1. ENSURE that the ‘part01’ and ‘part02’ folders contain all of the corresponding .java files.

3. Add your testing spreadsheet to the folder created in step 1.

4. Add the Microsoft Word document describing any additional features to the folder created in step 1.

5. Verify that you have all the required files included in the folder created in step 1.

6. Compress the folder to a zip file and upload it to the assignment location in the CSC1029 module on Canvas by 4.00pm on Friday 27th March, 2020.

NOTE: Please check that you have included the original development Java (.java) files. If you submit .class files these will NOT be marked. These submissions will be date-stamped and in accordance with University regulations, late submissions will be penalised. Failure to follow the submission instructions may result in a reduced or zero mark for part or all of the assignment!