Assignment – Software Implementation
Do not place your code here – provide the code as separate .py files submitted with this document.
Assignment – 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_float(prompt):
# ____________________________________
value = float(0.0)
# ____________________________________
while True:
try:
# ____________________________________
value = float(input(prompt))
# ____________________________________
if value < 0.0:
print("We don't accept negative money!")
continue
# ____________________________________
break
# ____________________________________
except ValueError:
print('Please enter a valid floating point value.')
# ____________________________________
return value
# Function to: ___________________________
def bag_products(product_list):
# ____________________________________
bag_list = []
non_bagged_items = []
MAX_BAG_WEIGHT = 5.0
# ____________________________________
for product in product_list:
# ____________________________________
if product.weight > MAX_BAG_WEIGHT:
product_list.remove(product)
non_bagged_items.append(product)
# ____________________________________
current_bag_contents = []
current_bag_weight = 0.0
# ____________________________________
while len(product_list) > 0:
# ____________________________________
temp_product = product_list[0]
product_list.remove(temp_product)
# ____________________________________
if current_bag_weight + temp_product.weight < MAX_BAG_WEIGHT:
# ____________________________________
current_bag_contents.append(temp_product)
current_bag_weight += temp_product.weight
# ____________________________________
if (len(product_list) == 0):
bag_list.append(current_bag_contents)
# ____________________________________
else:
bag_list.append(current_bag_contents)
# ____________________________________
current_bag_contents = []
current_bag_weight = 0.0
# ____________________________________
for index, bag in enumerate(bag_list):
output = 'Bag ' + str(index + 1) + ' contains: '
# ____________________________________
for product in bag:
output += product.name + 't'
print(output, 'n')
# ____________________________________
if (len(non_bagged_items) > 0):
output = 'Non-bagged items: '
# ____________________________________
for item in non_bagged_items:
output += item + 't'
print(output,'n')
Assignment 1 – FedUni Checkout
Student name: Student ID:
Part |
Assessment Criteria |
Weight |
Mark |
1a |
Identification of properties of a typical supermarket Product. |
10 * 0.5 = 5 marks |
|
1b |
Application of abstraction to identify key properties of a typical supermarket Product as well as creation of a suitable Class Diagram. |
4 marks |
|
1c |
Identification of the key properties of a CheckoutRegister 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 correct symbols for elements such as start/end points, processes and decisions/branches |
10 marks |
|
3 |
Programming of the product checkout simulation so that it: i) Creates a small number of Product instances that may be purchased, ii) Accepts simulated ‘scanning’ of a Product to identify it (including refusal to identify products which do not exist), iii) Adds a scanned Product to the CheckoutRegister’s list of products being purchased, iv) Allows the checkout of multiple products, v) Accepts ‘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 products purchased, along with the total cost, total paid and any change given. |
5 + 5 + 5 + 5 + 5 + 5 = 30 marks. |
i) ii) iiI) iv) v) vi) Total: |
4a |
Analysis and documentation via code comments of the two functions provided. |
(8 * 0.5) + (16 * 0.5) = 12 marks |
|
4b |
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 |
|
Assignment total (out of 65 marks) |
|||
Contribution to grade (out of 20 marks) |
Function to get a float value
Assignment Part 1 Details – Class Design
Product Properties (All) Product name – Shirt
Insert your list/table of key product properties here…Product Properties (Key) Complete the class diagram of your final Product class here…Product Class DiagramCheckoutRegister Class Diagram
Complete the class diagram of your final CheckoutRegister class here…
Assignment Part 2 – Activity Flowchart
Insert your activity flowchart of the supermarket checkout 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: get a valid floating point number from the user and return it
def get_float(prompt):
# initialize value as 0
value = float(0.0)
# loop infinite times
while True:
try:
# input a value from user showing prompt and convert it to float
value = float(input(prompt))
# if the entered value is negative continue the loop and ask the user to #enter again
if value < 0.0:
print("We don't accept negative money!")
continue
# break the loop as the value entered is a positive floating point number
break
# Exception is generated when user enters anything other than floating numbers
except ValueError:
print('Please enter a valid floating point value.')
# return the entered positive floating value
return value
# Function to: bag all the purchased items
def bag_products(product_list):
# initialize all the bag, unbagged and max bag weights
bag_list = []
non_bagged_items = []
MAX_BAG_WEIGHT = 5.0
# check all the products purchased
for product in product_list:
# if current product can not be contained in a bag as it is more than the bag #weight limit then put the product is non bagged items
if product.weight > MAX_BAG_WEIGHT:
product_list.remove(product)
non_bagged_items.append(product)
# initialize the bag contents as empty and weight as 0
current_bag_contents = []
current_bag_weight = 0.0
# loop till atleast 1 product is present in product list
while len(product_list) > 0:
# read the first product and remove it from the list
temp_product = product_list[0]
product_list.remove(temp_product)
# check if adding the current product in bag wont exceed the max bag weight
if current_bag_weight + temp_product.weight < MAX_BAG_WEIGHT:
# add the product to the bag and increase the current bag weight by product
current_bag_contents.append(temp_product)
current_bag_weight += temp_product.weight
# if all the products are added to the bag add the current bag to the bags #list
if (len(product_list) == 0):
bag_list.append(current_bag_contents)
# if adding the contents of the current product exceed the max bag weight of #current bag, add current bag to the bag list
else:
bag_list.append(current_bag_contents)
# initialize a new bag as empty and current weight as 0
current_bag_contents = []
current_bag_weight = 0.0
# Display all the bags to the user
for index, bag in enumerate(bag_list):
output = 'Bag ' + str(index + 1) + ' contains:
# Display all the products in the bag
for product in bag:
output += product.name + 't'
print(output, 'n')
# if there are any non bagged items present
if (len(non_bagged_items) > 0):
output = 'Non-bagged items: '
# display non bagged items to the user
for item in non_bagged_items:
output += item + 't'
print(output,'n')
Assignment 1 – FedUni Checkout
Student name: Student ID:
ProductCode |
Size |
Fit type (regular/slim) |
Age-Group |
Name |
Fabric |
Collar (round / vneck) |
Wash Type |
Price |
Color |
Category (men/women) |
Sleeves |
Product Code |
Name |
Price |
Size |
Part |
Assessment Criteria |
Weight |
Mark |
1a |
Identification of properties of a typical supermarket Product. |
10 * 0.5 = 5 marks |
|
1b |
Application of abstraction to identify key properties of a typical supermarket Product as well as creation of a suitable Class Diagram. |
4 marks |
|
1c |
Identification of the key properties of a CheckoutRegister 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 correct symbols for elements such as start/end points, processes and decisions/branches |
10 marks |
|
3 |
Programming of the product checkout simulation so that it: i) Creates a small number of Product instances that may be purchased, ii) Accepts simulated ‘scanning’ of a Product to identify it (including refusal to identify products which do not exist), iii) Adds a scanned Product to the CheckoutRegister’s list of products being purchased, iv) Allows the checkout of multiple products, v) Accepts ‘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 products purchased, along with the total cost, total paid and any change given. |
5 + 5 + 5 + 5 + 5 + 5 = 30 marks. |
i) ii) iiI) iv) v) vi) Total: |
4a |
Analysis and documentation via code comments of the two functions provided. |
(8 * 0.5) + (16 * 0.5) = 12 marks |
|
4b |
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 |
|
Assignment total (out of 65 marks) |
|||
Contribution to grade (out of 20 marks) |
To export a reference to this article please select a referencing stye below:
My Assignment Help. (2020). Assignment - Software Implementation. Retrieved from https://myassignmenthelp.com/free-samples/itech-1400-super-market-self-service-checkout.
"Assignment - Software Implementation." My Assignment Help, 2020, https://myassignmenthelp.com/free-samples/itech-1400-super-market-self-service-checkout.
My Assignment Help (2020) Assignment - Software Implementation [Online]. Available from: https://myassignmenthelp.com/free-samples/itech-1400-super-market-self-service-checkout
[Accessed 22 November 2024].
My Assignment Help. 'Assignment - Software Implementation' (My Assignment Help, 2020) <https://myassignmenthelp.com/free-samples/itech-1400-super-market-self-service-checkout> accessed 22 November 2024.
My Assignment Help. Assignment - Software Implementation [Internet]. My Assignment Help. 2020 [cited 22 November 2024]. Available from: https://myassignmenthelp.com/free-samples/itech-1400-super-market-self-service-checkout.