School of Science, Engineering and Information Technology
ITECH1400 – Foundations of Programming
School of Science, Engineering and Information Technology
ITECH1400 - Assignment 1 – Supermarket Self-Service Checkout
Student Name: Student ID:
Assignment Part 1 Details – Class Design
Insert your list/table of possible RecycleableItem properties here…
RecycleableItem Properties (All)
Insert your list/table of key product properties here…
RecycleableItem Properties (Key)
Complete the class diagram of your final RecycleableItem class here…
RecycleableItem Class Diagram
RecyclingMachine Class Diagram
Complete the class diagram of your final Recycling class here…
Assignment Part 2 – Activity Flowchart
Insert your activity flowchart of the recycling machine process here… If your flowchart is large then place it on the following page.
Assignment Part 3 – Software Implementation
Do not place your code here – provide the code as separate .py files submitted with this document.
Assignment Part 4 – Code Explanation and Use
Update the below code to insert comments describing what the code is doing – for each line starting with a hash symbol (#) you should write your code comments after the hash. You may add a second line of comments if you require more space.
# Function to: ___________________________
def get_int(prompt):
# ____________________________________
value = int(0)
# ____________________________________
while True:
XXXXXXXXXXtry:
# ____________________________________
XXXXXXXXXXvalue = int(input(prompt))
# ____________________________________
XXXXXXXXXXif value < 0:
XXXXXXXXXXprint("We don't accept a negative number of items!")
XXXXXXXXXXcontinue
# ____________________________________
eak
# ____________________________________
XXXXXXXXXXexcept ValueE
or:
XXXXXXXXXXprint('Please enter a valid integer value.')
# ____________________________________
return value
# Function to: ___________________________
def accept_item(item_list):
# ____________________________________
item_list = []
non_accepted_items = []
MAX_WEIGHT = 15.0
# ____________________________________
for item in item_list:
# ____________________________________
XXXXXXXXXXif item.weight > MAX_BAG_WEIGHT:
XXXXXXXXXXitem_list.remove(item)
XXXXXXXXXXnon_accepted_items.append(item)
# ____________________________________
cu
ent_contents = []
cu
ent_weight = 0.0
# ____________________________________
while len(item_list) > 0:
# ____________________________________
XXXXXXXXXXtemp_item = item _list[0]
XXXXXXXXXXitem_list.remove(temp_item)
# ____________________________________
XXXXXXXXXXif cu
ent_weight + temp_item.weight < MAX_WEIGHT:
# ____________________________________
XXXXXXXXXXcu
ent_contents.append(temp_item)
XXXXXXXXXXcu
ent_weight += temp_item.weight
# ____________________________________
XXXXXXXXXXif (len(item_list) == 0):
XXXXXXXXXXproducts_item.append(cu
ent_contents)
# ____________________________________
XXXXXXXXXXelse:
XXXXXXXXXXitem_list.append(cu
ent_contents)
# ____________________________________
XXXXXXXXXXcu
ent_contents = []
XXXXXXXXXXcu
ent_weight = 0.0
# ____________________________________
for index, bag in enumerate(machine_list):
XXXXXXXXXXoutput = 'Machine ' + str(index + 1) + ' contains: '
# ____________________________________
XXXXXXXXXXfor item in items:
XXXXXXXXXXoutput += item.name + '\t'
XXXXXXXXXXprint(output, '\n')
# ____________________________________
if (len(non_accepted_items) > 0):
XXXXXXXXXXoutput = 'Non-bagged items: '
# ____________________________________
XXXXXXXXXXfor item in non_accepted_items:
XXXXXXXXXXoutput += item + '\t'
XXXXXXXXXXprint(output,'\n')
Assignment 1 – FedUni Checkout
Student name: Student ID:
Part
Assessment Criteria
Weight
Mark
1a
Identification of properties of a typical item that can be recycled – RecycleableItem.
10 * 0.5 = 5 marks
1
Application of abstraction to identify key properties of a typical RecycleableItem as well as creation of a suitable Class Diagram.
4 marks
1c
Identification of the key properties of a RecyclingMachine as well as creation of a suitable Class Diagram which uses those properties, plus the four method signatures provided.
4 marks
2
Creation of an activity flowchart which clearly indicates how the program should operate, using the co
ect symbols for elements such as start/end points, processes and decisions
anches
10 marks
3
Programming of the product checkout simulation so that it:
i) Creates a small number of RecycleableItem instances that may be accepted,
ii) Accepts simulated ‘deposting’ of a RecycleableItem after being identified from a list by the user,
iii) Adds a RecycleableItem to the RecyclingMachine list of products being purchased,
iv) Allows the deposit of multiple items,
v) Provides ‘virtual money’ to pay for those products (you must pay enough to cover the cost of the items checked out), and
vi) Prints a final receipt of the items deposited, along with the number of items and amount for each item, along with the total paid out.
XXXXXXXXXX4 = 24 marks.
i)
ii)
iiI)
iv)
v)
vi)
Total:
4a
Analysis and documentation via code comments of the two functions provided.
(8 * XXXXXXXXXX * 0.5) = 12 marks
4
Incorporation of the two functions provided into your main submission so that the program does not crash when an illegal money value is provided, and also virtually ‘bags up’ the products purchased.
2
Overall
Overall code standard including comments, formatting, variable names
9
Assignment total (out of 70 marks)
Contribution to grade (out of 20 marks)
Comments:
CRICOS Provider No. 00103D
Insert file name here
Page 6 of 8
CRICOS Provider No. 00103D
Page 1 of 5