Professional Documents
Culture Documents
1. Due Date
This assignment uses the skills and knowledge you have learnt in Java 1 up to and including
ArrayLists & Inheritance. It is a simulation of a work task.
The completed application is due 08 September 2016 at 11pm by submitting in eLearn. Face-to-face
students should also demonstrate it to teachers in class. The resubmit, if required, is due 15
September 2016 at 11pm.
Please note that procedures in the IT Department at CIT require submission on time unless a doctors
certificate is provided, otherwise you will need to resubmit having lost your first chance.
1. Classes match class diagrams & all attributes are declared private
2. Code is well structured, uses camel case naming standards & is commented
including javadoc comments (the /** comments generated by default at the
top of each class where you can enter your name and the date)
3. Put your name as the name of the shop in the test script and ensure that it
works and produces the expected results
Java 1 Assignment 2
Class Diagrams
Item (abstract)
Shop
String name
double price;
int numInStock
int numSold;
String storeName
ArrayList items
Shop(String inStoreName)
boolean addItem(Item newItem)
boolean findItem(String searchName)
void listItems()
void listLowStockToFile(int threshhold)
void listGamesByPlatform(String inPlatform)
void calcTotalSales()
CD (extends Item)
String artist
Java 1 Assignment 1
Java 1 Assignment 1
Java 1 Assignment 1
Expected report to be written out to the file by above system test (where Amy Smith is replaced
by your name):
Low Stock (less than 8) Report for Amy Smith Superstore
*** The shop has low stock (less than 8) of the following items: ***
Game Chess price $39.95 stock:5 sold:0 Max Players:2
ElectronicGame Doom price $30.2 stock:0 sold:1 Max Players:2 Platform:PC
ElectronicGame AFL price $49.95 stock:0 sold:0 Max Players:2 Platform:PS2
3. Hints
Details are provided below for non-straightforward methods:
Item
receiveStock() takes the number of copies received as a parameter and adds it to numInStock
sellCopy() checks that numinStock is greater than zero and if adds 1 to the number sold, decreases the
number in stock & returns true; otherwise writes an error message & returns false
toString() returns the class name and attribute values
Shop
addItem() takes an item as a parameter, calls findItem() passing the item name as a parameter to see if there
is already an item by that name in the Shop ArrayList (name must be unique), and either adds the item to the
ArrayList returning true or writes an error message and returns false
findItem() takes an item name as a parameter and loops through the ArrayList looking for an item with that
name
listItems() loops through the ArrayList calling the toString() method for each item and writing it out
listLowStockToFile() takes a threshold as a parameter; loops through the ArrayList and prints out any item
that has less stock than the threshold amount. The printing should be to a file c:\LowStock.txt and should print
as the first line Low Stock (less than x) Report for YYY where x is the threshold parameter supplied when the
method is run and YYY is your name.
listGamesByPlatform() loops through the ArrayList and for any item that is an ElectronicGame prints it out if it
is for the same platform as the parameter
4. Submission Format
You are required to code all the classes in a BlueJ project. Also include the TestShop class with no
changes made to the code except to change the name of the shop from Amy smith Superstore to your
name. After successfully testing you should zip up the whole folder in which your BlueJ project is
stored and submit it on eLearn.
5. Requirements
Some requirements to successfully pass the assignment are:
1. Classes match class diagrams & all attributes are declared private
2. Code is well structured, uses camel case naming standards & is commented
including javadoc comments (the /** comments generated by default at the
top of each class where you can enter your name and the date)
3. Put your name as the name of the shop in the test script and ensure that it
works and produces the expected results
Java 1 Assignment 1
6. Assessment
Your assignment will be assessed against the following performance, knowledge & evidence criteria & all must
be passed. The corresponding requirement is shown in brackets after each one.
ICTPRG406
1.7 Use the facilities of the language to read and write data, from and to, text files, and record the
outcomes
2.4 Use the facilities of the language to implement inheritance, to at least two levels
2.5 Use polymorphism at a simple level through inheritance, to enable the easy extension of the code
5.1 Create and conduct simple tests, to confirm that the code meets the design
specification
5.2 Document the tests performed and the results achieved
ICTPRG404
Java 1 Assignment 1