ITECH1400 – Foundations of Programming – SEM2/18 School of Science, Engineering and Information Technology CRICOS Provider No. 00103D Page 1 of 7 ITECH1400 - Assignment 1 – Supermarket Self-Service...

1 answer below »
Hi please tell me the price


ITECH1400 – Foundations of Programming – SEM2/18 School of Science, Engineering and Information Technology CRICOS Provider No. 00103D Page 1 of 7 ITECH1400 - Assignment 1 – Supermarket Self-Service Checkout Due Date: 5pm, Friday of Week 7 This assignment will test your skills in designing and programming applications to specification and is worth 20% of your non-invigilated (type A) marks for this course. This is an INDIVIDUAL ASSIGNMENT – and while you may discuss it with your fellow students, you must not share designs or code or you will be in breach of the university plagiarism rules. This assignment should take you approximately 20 hours to complete. Assignment Overview You are tasked with creating a text-based program for simulating a supermarket self-service checkout using the Python 3 programming language. The assignment is broken up into four main components: 1.) Design and model two classes: Product and CheckoutRegister, 2.) Create an activity chart which describes the behaviour of the checkout system, 3.) Create a computer program that allows a user to interactively check out a number of products, then provides an opportunity to enter some virtual money to pay for the products and finally and prints out a receipt for the user (to the screen, not on paper), and finally 4.) Explain and integrate some code into your checkout program that places the products purchased into virtual shopping bags. Your submission should consist of one Microsoft Word or LibreOffice document containing the first two parts of the assignment, and three Python scripts that implement the computer program (checkoutregister.py, product.py and main.py). The main.py script runs the main logic of the program and will use instances of the CheckoutRegister and Product classes to simulate checking out of the supermarket. You are provided with a Microsoft Word template to help you complete the first two parts of this assignment. Towards the end of this document you will also be provided with the output of a simulated run of the completed computer program which may help you with this assignment. ITECH1400 – Foundations of Programming – SEM2/18 School of Science, Engineering and Information Technology CRICOS Provider No. 00103D Page 2 of 7 Assignment Part 1 Details – Class Design Think of a product that you can buy from a supermarket, like maybe a can of soup or an apple. Start by listing all the properties of that object that you can think of – try to come up with at least ten general properties of a Product and write these down in your Assignment_Part_1_ Microsoft Word document. Next, use the process of abstraction to cut the number of properties back to only four ‘key’ properties – write these down in the next section of your Word document. Take a look at the week 2 lecture slides if you need a reminder on how to go about this. Now, fill in the class diagram for your Product class in the Word document template provided. Your product class does not have to have any methods (i.e. functions) associated with it to perform any actions other than a constructor which takes and set the four key properties that you’ve identified. Next we’ll move on to CheckoutRegister class – think about what information the checkout has to keep track of to allow you to successfully check out of the supermarket. There will only really be three key properties that the CheckoutRegister cares about, and the CheckoutRegister class should have the following four methods available: 1) A default constructor that takes no arguments and initialises a new object and its properties, 2) accept_payment(some_amount), 3) scan_item(some_product), and 4) print_receipt(). Fill in the class diagram for the CheckoutRegister class in the Word template, and that’s the first part completed! Assignment Part 2 Details – Activity Flowchart Using either the online website https://draw.io (preferred), or the applications Visio or Powerpoint – create an activity diagram of how the program should operate to successfully scan one or more products, accept payment, provide change and print a receipt for the user. Make sure to use the correct symbols in your diagram for starting, processes, decisions/branches, and ending the process. Although you should be familiar with how a self-checkout works, if not then you can always go to a local supermarket with a self-checkout and buy a packet of chewing gum or something – or take a look at a YouTube video of self-service checkout, such as this one: https://www.youtube.com/watch?v=hoyqVvHaL4s. Don’t worry about loyalty/rewards cards to taking payment through debit or credit cards, our CheckoutRegister will only accept cash – although you can enter multiple denominations via multiple calls to the accept_money(some_amount) method. For example, calling accept_money(5.0) and then accept_money(2.0) will mean that the CheckoutRegister knows that you have entered a total of $7.00. Also note that you can start the entire checkout process off by simply scanning a product. Once you have completed your activity flowchart, add it to your assignment template document. https://draw.io/ https://www.youtube.com/watch?v=hoyqVvHaL4s ITECH1400 – Foundations of Programming – SEM2/18 School of Science, Engineering and Information Technology CRICOS Provider No. 00103D Page 3 of 7 Assignment Part 3 Details – Software Implementation You are free to implement the software however you see fit, however the functionality of the software should be able to match the following output. Note that in the below run of the program I have ‘hard-coded’ a small number of Product instances so that products exist which can they can be checked out – in your code you should do the same. Your program does not have to have the facility to add new products – just define a few and use them as demonstrated below. If the final option of (N)ext customer is chosen, the program should run again Example Program Output ----- Welcome to FedUni checkout! ----- Please enter the barcode of your item: 123 Milk, 2 Litres - $2.0 Would you like to scan another product? (Y/N) y Please enter the barcode of your item: 456 Bread - $3.5 Would you like to scan another product? (Y/N) y Please enter the barcode of your item: 999 This product does not exist in our inventory. Would you like to scan another product? (Y/N) n Payment due: $5.5. Please enter an amount to pay: 5 Payment due: $0.5. Please enter an amount to pay: -3 We don't accept negative money! Payment due: $0.5. Please enter an amount to pay: 2 ----- Final Receipt ----- Milk, 2 Litres $2.0 Bread $3.5 Total amount due: $5.5 Amount received: $7.0 Change given: $1.5 Thank you for shopping at FedUni! (N)ext customer, or (Q)uit? q >>> ITECH1400 – Foundations of Programming – SEM2/18 School of Science, Engineering and Information Technology CRICOS Provider No. 00103D Page 4 of 7 Part 4 – Code Explanation and Use You are provided with the following two functions which you should 1. Analyse to determine what they do & provide documentation comments for, and 2. Incorporate into your final program solution. Wherever there is a # followed by some underscores in the code below, you should write a short comment explaining what the below section of code is doing, and if there is space why it is doing it. Do part 1 of the above in the provided assignment 1 template document, rather than here! # 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:="" itech1400="" –="" foundations="" of="" programming="" –="" sem2/18="" school="" of="" science,="" engineering="" and="" information="" technology="" cricos="" provider="" no.="" 00103d="" page="" 5="" of="" 7="" #="" ____________________________________="" 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 # ____________________________________ else: bag_list.append(current_bag_contents) # ____________________________________ max_bag_weight:="" #="" ____________________________________="" current_bag_contents.append(temp_product)="" current_bag_weight="" +="temp_product.weight" #="" ____________________________________="" else:="" bag_list.append(current_bag_contents)="" #="">
Answered Same DayAug 23, 2020ITECH1400

Answer To: ITECH1400 – Foundations of Programming – SEM2/18 School of Science, Engineering and Information...

Abr Writing answered on Aug 27 2020
148 Votes
checkoutregister.py
from product import Product
class CheckOutRegister:
    # Function to: A default constructor that takes no arguments and initializes a new object and its properties,
    def __init__(self):
        # cart contains the products that are scanned by the customer
        self.bag_list = list()
        # current_bag_price
gives the money that customer owe to the market including any payment by the customer
        self.current_bag_price = 0
        # bag_price is the total money that the customer owes
        self.bag_price = 0
        # product_list contains all the products' details that are available in market
        self.product_list = Product()
        # amount_paid is the amount received from customer at any moment
        self.amount_paid = 0
    
    # Function to: Accept Payment
    def accept_payment(self, some_amount):
        # Checking if the money is positive or not
        if some_amount >= 0:
            self.current_bag_price = self.current_bag_price - some_amount
            self.amount_paid += some_amount
        else:
            print("We don't accept negative money!")
    
    # Function to: Scan products, one at a time
    def scan_item(self, some_product):
        # Adding the customer's product to their bag
        try:
            index = self.product_list.barcode.index(int(some_product))
            self.bag_list.append(index)
            self.bag_price += self.product_list.price[index]
            self.current_bag_price += self.product_list.price[index]
            print(self.product_list.name[index], ' - ', self.product_list.price[index])
        except:
            # If no such product is found in the inventory
            print('This product does not exist in our inventory.')
    
    # Function to: Print a receipt for the user and return the balance
    def print_receipt(self):
        # Printing the receipt as per the problem statement
        print('----- Final Receipt -----')
        for item in self.bag_list:
            print(self.product_list.name[item], self.product_list.price[item])
        print('Total amount due: $' + str(self.bag_price))
        print('Amount received: $' + str(self.amount_paid))
        print('Change given: $' + str(self.amount_paid - self.bag_price))
        print('Thank you for shopping at FedUni!')
main.py
from checkoutregister import CheckOutRegister
# 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 customer
    while regn.current_bag_price > 0:
        prompt = "Payment due: $" + str(regn.current_bag_price) + ". Please enter an amount to pay: "
        amount = input(prompt)
        try:
            regn.accept_payment(float(amount))
        except:
            print('Please enter valid money')
        
    #...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here