1
COMP5214 Software Development in Java Assignment Semester2, 2014
Electronic Inventory Records Management (EIRM)
Design Draft Due: 6:00PM, Wednesday (in Week 9), 24 Sep 2014
Prototype Demo: 6:00PM, Wednesday (in Week 10), 8 Oct 2014
Completed Assignment Due: 6:00PM, Wednesday (in Week12), 22 Oct 2014
GENERAL DESCRIPTION
This INDIVIDUAL software development assignment consists of THREE PARTS, and is worth 22% of
the assessment of this course. In this individual assignment, you will develop Java software for managing
the inventory records of a virtual shop.
1. PART ONE (2 Marks) requires that you submit a design draft of the assignment. Your tutor will
provide you some critical feedback on your design draft. In turn, this feedback should be used to
further improve your software development. Your design draft should describe:
all the classes needed,
the data and methods of each class,
the relationship of the classes.
2. PART TWO (2 Marks) requires you to demonstrate a prototype of your software using lab
computers. At this stage, you must demonstrate that:
your code compiles and runs via command line,
your programs are able to read from and write to files,
your programs have ‘add’ or ‘delete’ functionality,
your software can be run with simple inputs, and produces some outputs accordingly.
3. PART THREE (18 Marks) is the completion of the software development assignment.
SOFTWARE DESCRIPTION
In this individual assignment, you will create a Java software package to manage the shop inventory
records according to the given instructions/commands.
1. Your software must:
Read and validate the contents of TWO input files (including inventory file and instruction file),
and
Process the inventory records in the inventory file according to the instructions in the instruction
file. The instructions should be performed sequentially (i.e. one after the other).
When your program ends, your software saves the resulting inventory list (after being processed)
to TWO output files (that are the file containing the processed inventory list, and the report file).
2. Your software must be executed using command line in the following format:
java EIRM14S2/EIRM inventoryfile instructionfile outputfile reportfile
EIRM14S2 is the package containing your assignment software.
EIRM is the name for the main class.
inventoryfile – is a command line argument specifying the full path and name of an input file
containing the list of product items.
instructionfile – is a command line argument specifying the full path and name of an input file
containing the set of operations to be carried out by your software.
outputfile – is a command line argument specifying the full path and name of an output file
where the resulting records to be saved by your software.
reportfile – is a command line argument specifying the full path and name of a file where the
output of query commands will be stored.
2
COMP5214 Software Development in Java Assignment Semester2, 2014
DO NOT implement a graphical user interface (GUI). DO NOT hard code the names of the
command line arguments as they will change between runs of the program. Some example
invocations using the Command Prompt:
java EIRM14S2/EIRM Z:\rec\inv01.txt Y:\instr01.txt X:\out\out01.txt W:\report01.txt
java EIRM14S2/EIRM C:\rec007\product.txt D:\comm.txt E:\out.txt U:\rpt.txt
FORMAT AND DESCRIPTION OF INPUT INVENTORY DATA
1. Your software needs to read in the valid inventory records in the product file.
When your EIRM system starts up, it assumes that the shop has the products as given in the
inventory file, and it manages the shop inventory according to the instructions in the
instruction file.
2. An input inventory record has necessary information of a product item. Each record consists of
multiple fields to specify the product name, prices, quantity, and dates etc.
The fields include: “product” (name of the product), “quantity” (in stock quantity),
“boughton” (date of purchase) / soldon (date of sale), “boughtat” (price of purchase) / soldat
(price of sale), “useby” (best-before date).
Single/Multiple spaces and/or Tab characters separate the name of the field and the
value/content of the field.
The “product” and “quantity” fields are MANDATORY for EVERY record. All other fields are
optional.
Each field begins on a new line; the name of the field is the first word on this line. However, the
value for some fields may spread across multiple lines.
Fields may occur in any order
3. Description of Fields
product: is a string to specify the name of a product.
quantity: is a numeric value to specify the in stock quantity of a product.
boughton, useby, soldon: are the dates in the format of “(d)d-(m)m-(yy)yy”. Example: 11-07-
2014 or 2-2-14.
boughtat, soldat: are the price of purchase/sale of a product. Starts with a dollar sign “$” and
followed by a numeric value.
Example: "products_1.txt" is a sample file containing product records, as below:
product sugar
boughton 13-5-2014
useby 12-12-2014
boughtat $3.56
quantity 100
product sauce pan
quantity 10
boughtat $19.99
boughton 13-5-2014
4. The input inventory file contains zero or multiple inventory records in a predefined format.
Records are separated by blank line(s).
If there is an error in the format of the “product” or “quantity” fields, the entire record is
discarded and not read. If the error occurs for any other field, only the erroneous field is
omitted.
FORMAT AND DESCRIPTION OF INSTRUCTIONS
1. Your software needs to read in and parse the valid commands in instruction file.
2. The instruction file contains zero or more instructions to be performed on product items.
Each instruction occurs on a new line.
3
COMP5214 Software Development in Java Assignment Semester2, 2014
There are five possible instructions: “buy”, “sell”, “discard”, “sort”, and “query”.
Each instruction begins with one of the five instructions followed by a list of parameters.
3. Description of instructions
buy a certain quantity of product(s) and add all the product(s) into the stock. The instruction
“buy” is followed by the fields and their corresponding values. Fields are separated by
semicolons and single/ multiple spaces (“; ”) and may occur in any order.
o The command MUST contain values for the “name” and “quantity” fields.
o For instance, the instruction
buy product milk; boughton 31-3-2014; useby 5-4-2014;
boughtat $4.63; quantity 100
means: on 31/3/2014, 100 bottles of milk with a use-by date of 5/4/2014, at a price
of $4.63 were bought.
sell a certain quantity of a specific type of product(s)
o For instance, the instruction
sell product coffee; soldon 4-4-2014; soldat $9.88;
quantity 1
indicates: 1 tin of coffee was sold on 4/4/2014 at the price of $9.88 and the stock and
retail information need to be updated correspondingly. The command would be
ignored if no sufficient available stocks; and we do not sell expired product(s).
NOTE: The ESM system assumes that, for each type of product, the product items
with the earliest “use-by” date would be sold first.
sort the records in ascending order based on the value of a field. The command “sort”
followed by the name of a field.
o Your program MUST implement a sorting algorithm and MUST NOT invoke any
sorting function from the Java API.
An example:
sort useby
indicates: sort all the product in ascending order of “use-by” dates.
discard the expired product item(s)
For instance, the instruction
discard 5-3-2014
indicates: discard all the product items that would be expired on 5/3/2014. Each
product is supposed to be expired on the next day of its use-by date. The stock
information need to be updated correspondingly.
query certain information from the collection based on field values. There are THREE formats
for this instruction.
(1) Format 1: query the available inventory on a given date. For instance, the instruction
query 8-5-2014
reports
1) a list of available product items in stock on this date (eg 8/5/2014), with
information of product name, quantity and use-by date. The query results should
be displayed in ascending order of use-by date.
2) the suggestions on purchasing products if the quantity of the available products is
less than 10.
(2) Format 2: query the best or worst sales during a given period of time. The instruction
“query” followed by the word “bestsales” or “worstsales” and two dates. For instance,
the instruction
query bestsales 01-06-2014 30-6-2014
or
query worstsales 01-06-2014 30-6-2014
4
COMP5214 Software Development in Java Assignment Semester2, 2014
reports the bestsales (or worstsales) products during the sale period from 1/6/2014 to
30/6/2014. The bestsales (or worstsales) are determined according to the return on
assets (ROA) [1] for each type of product. Products with highest (or lowest) ROA are
considered the bestsales (or worstsales). The formula for ROA is:
2 / end begin Quantity Quantity
Income Net
ROA
where Net Income is defined as the difference between net sales and purchasing cost,
and Quantitybegin and Quantityend are the product quantities at the beginning and the
end of the sale period respectively.
(3) Format 3: query the profit gained during a given period. The command “query”
followed by the word “profit” and two dates.
For instance, the instruction
query profit 3-3-2014 2-4-2014
reports
1) the net income gained during the given period (eg from 3/3/2014 to 2/4/2014);
2) the loss due to discarding the out-of-date items, and list the discarded items in
descending order of costs.
FORMATE OF OUTPUT FILES
1. Your software needs to save the resulting data collection to files including output file and report
file.
a. Save the resulting data collection of the instructions of “buy”, “sell”, and “discard” into
an output file.
b. Save the query results to a separate report file. When there are more than one “query”
command, append the new query results to the end of the report file. The results of
different queries should be separated by a line with three dashes (“---“).
2. The output files should have all the necessary resulting records.
3. Each field should fit on ONE line only
4. Records should be separated by blank line(s)
5. Report File: the results of different queries should be separated by a line with three dashes (“---”).
IMPORTANT NOTES
1. Your code must make use of at least one collection e.g. ArrayList.
2. Your system must be able to handle both normal cases and difficult cases.
3. You MUST NOT build a graphic user interface.
4. You need to do systematic testing of the classes you create.
5. Your program must run on the computers in your lab classes, and must be demonstrated during your
laboratory class to your tutor in week 10 and in week 12. Being absent from the demos will incur
a penalty of 4 marks. If you miss the labs in weeks 10 and/or 12 because of serious illness or
misadventure, you should request Special Consideration using the appropriate forms within a week.
6. Recall that the University takes plagiarism very seriously, and it would be useful for you to review
this policy
(http://sydney.edu.au/engineering/it/current_students/postgrad_coursework/policies/academic_honesty.shtml ).
MARKING SCHEME
There are 4 parameters on which your submission will be marked:
1. Design [4 marks]: 2 marks at PART 1 (in week 9), and 2 marks at the final submission
2. Prototype Demo [2 marks]: in week 10
3. Implementation and testing [14 marks]: at the final submission
4. Standard of coding [2 marks]: at the final submission.
5
COMP5214 Software Development in Java Assignment Semester2, 2014
SUBMISSION
1. PART 1 — Design Draft
During your lab class in Week 9 you must hand in a design document to your tutor.
o An assignment cover sheet with declaration and your signature, and
o Documentation of your software design, e.g. Class responsibilities and UML diagrams.
2. PART 2 — Prototype Demonstration
You will demonstrate your program to your tutor in Week 10. Your program should have the basic
functionality at this stage, and should be able to handle normal cases (i.e. cases where all field
names/values are correct). You will get the mark as long as your program runs smoothly by being
invoked from the command prompt using the sample testing files released in Week 9. This part will
assess your progress and provide you with more feedback.
3. PART 3 — Complete assignment
Submit before 6:00PM, Wednesday 22 October 2014 (Week 12).
Late submissions will incur a penalty of 2 marks per day.
You must submit a hard copy to your tutor in your scheduled lab in week 12:
o An assignment cover sheet with declaration and your signature, and
o Documentation of your software design, e.g. Class responsibilities, UML diagrams and
development process.
You must ALSO submit a single .zip archive to your tutor before the deadline. The .zip archive
must be named with your login ID, e.g. if your login ID is "abcd1234" then the archive must be
called "abcd1234.zip". It should contain:
o Your program (all Java source code), and in correct architecture.
o Documentation of your software design, e.g. Class responsibilities, UML diagrams and
development process.
REFERENCE
[1] http://www.crfonline.org/orc/cro/cro-16.html