Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

School of Science, Engineering and Information Technology ITECH1400 – Foundations of Programming School of Science, Engineering and Information Technology ITECH1400 - Assignment 1 – Supermarket...

1 answer below »

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 product properties here…
Product Properties (All)
    
    
    
    
    
    
    
    
    
    
    
    
Insert your list/table of key product properties here…
Product Properties (Key)
    
    
    
    
Complete the class diagram of your final Product class here…
Product Class Diagram
CheckoutRegister 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: ___________________________
defget_float(prompt):
# ____________________________________
value =float(0.0)
# ____________________________________
whileTrue:
try:
# ____________________________________
XXXXXXXXXXvalue = float(input(prompt))
# ____________________________________
if value <0.0:
print("We don't accept negative money!")
continue
# ____________________________________
eak
# ____________________________________
exceptValueE
or:
print('Please enter a valid floating point value.')
# ____________________________________
eturn value
# Function to: ___________________________
defbag_products(product_list):
# ____________________________________
ag_list=[]
non_bagged_items=[]
MAX_BAG_WEIGHT =5.0
# ____________________________________
for product inproduct_list:
# ____________________________________
ifproduct.weight> MAX_BAG_WEIGHT:
product_list.remove(product)
non_bagged_items.append(product)
# ____________________________________
cu
ent_bag_contents=[]
cu
ent_bag_weight=0.0
# ____________________________________
whilelen(product_list)>0:
# ____________________________________
temp_product=product_list[0]
product_list.remove(temp_product)
# ____________________________________
ifcu
ent_bag_weight+temp_product.weight< MAX_BAG_WEIGHT:
# ____________________________________
cu
ent_bag_contents.append(temp_product)
cu
ent_bag_weight+=temp_product.weight
# ____________________________________
if(len(product_list)==0):
ag_list.append(cu
ent_bag_contents)
# ____________________________________
else:
ag_list.append(cu
ent_bag_contents)
# ____________________________________
cu
ent_bag_contents=[]
cu
ent_bag_weight=0.0
# ____________________________________
for index, bag in enumerate(bag_list):
XXXXXXXXXXoutput ='Bag '+str(index +1)+' contains: '
# ____________________________________
for product in bag:
XXXXXXXXXXoutput += product.name +'\t'
print(output,'\n')
# ____________________________________
if(len(non_bagged_items)>0):
XXXXXXXXXXoutput ='Non-bagged items: '
# ____________________________________
for item innon_bagged_items:
XXXXXXXXXXoutput += 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
    
    1
    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 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 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.
     XXXXXXXXXX5 = 30 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
    
    
    
    
    
    
    Assignment total (out of 65 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
Answered Same Day May 08, 2020 ITECH1400

Solution

Abr Writing answered on May 11 2020
140 Votes
main.py
from checkoutregister import CheckOutRegiste
# Variable to check if there are more customers or not
newCustomer = True
# Loop for all the customers
while newCustomer:
    print('----- Welcome to FedUni checkout! -----')
    # Creating a new instance of the CheckOutRegister class
    regn = CheckOutRegister()
    # Variable to check if there are more products that a customer wants to buy
    loopProduct = True
    # Loop for all the products that a customer wants to buy from supermarket
    while loopProduct:
        product = input('Please enter the barcode of your item: ')
        # Scanning the product into cart
        regn.scan_item(product)
        nxt = input('Would you like to scan another product? (Y/N)')
        if str(nxt).lower() == 'y':
            continue
        elif str(nxt).lower() == 'n':
            loopProduct = False
    
    # Receiving Payment from the custome
    while regn.remaining > 0:
        prompt = "Payment due: $" + str(regn.remaining) + ". Please enter an amount to pay: "
        amount = input(prompt)
        try:
            regn.accept_payment(float(amount))
        except:
            print('Please enter valid money')
        
    # Printing receipt
    regn.print_receipt()
    
    # Asking whether there are more customers or not
    nxt = input('(N)ext customer, or (Q)uit? ')
    if str(nxt).lower() == 'n':
        continue
    elif str(nxt).lower() == 'q':
        
eak
product.py
class Product:
    # Function to: A default constructor that takes no arguments and initializes a new object and its properties
    def __init__(self):
        self.name = ['Milk, 2 Litres', 'Bread']
        self.barcode = [123, 456]
        self.price = [2.0, 3.5]
30501.docx
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 product properties here…
Product Properties (All)
        Name
        Barcode
        Price
        In inventory?
        In customer’s cart?
        
        
        
        
        
        
        
Insert your list/table of key product properties here…
Product Properties (Key)
        Name
        Barcode
        Price
        In customer’s cart?
Complete the class diagram of your final Product class here…
Product Class Diagram
(
Product
A default constructor that takes no arguments and initializes a new object and its properties
)
CheckoutRegister Class Diagram
Complete the class diagram of your final CheckoutRegister class here…
(
CheckoutRegiste
)
(
some_amount : Intege
,
some_product : Intege
)
(
accept_payment(some_amount),
scan_item(some_product),
print_receipt().
)
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.
(
Start
) (
Scan Products
) (
More Products?
) (
Yes
) (
Accept Payment
) (
Payment Complete?
) (
Print Receipt
) (
No
) (
No
) (
Next Customer?
) (
End
) (
Yes
) (
No
) (
Yes
)
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...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here