Assignment 2

pdf

School

Federation University *

*We aren’t endorsed by this school

Course

PY

Subject

Computer Science

Date

Nov 24, 2024

Type

pdf

Pages

4

Uploaded by mariyammasadaf

Report
CT701 Programming Fundamentals Page 1 of 4 Assignment 2 – Supermarket Self-Service Checkout This assignment will test your skills in designing and programming applications to specification and is worth 30% of your 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 two main components: 1.) Design and model two classes: Product and CheckoutRegister , 2.) 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 Your submission should consist of one Microsoft Word or LibreOffice document containing the first part 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. 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. 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_<YOUR_STUDENT_ID> 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. Now, fill in the class diagram for your Product class in the Word document. Your product class does not have
CT701 Programming Fundamentals Page 2 of 4 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 – 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 X-mart 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
CT701 Programming Fundamentals Page 3 of 4 ----- 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 X-mart! (N)ext customer, or (Q)uit? q >>> Submission and Marking Process You must supply your program source code files and your document containing the class design and test cases. Assignments will be marked on the basis of fulfilment of the requirements and the quality of the work. In addition to the marking criteria, marks may be deducted for failure to comply with the assignment requirements, including (but not limited to): Incomplete implementation(s), and Incomplete submissions (e.g. missing files), and Poor spelling and grammar. Submit your assignment (all program source files plus your word processed document) to the Assignment 2 Upload location on Moodle before the deadline. The mark distribution for this assignment is explained on the next page – please look at it carefully and compare your submission to the marking guide.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
CT701 Programming Fundamentals Page 4 of 4 Assignment 2 Student name: Student ID: Part Assessment Criteria Weight Mark 1a Identification of properties of a typical supermarket Product . 10 * 0.2 = 2 marks 1b Application of abstraction to identify key properties of a typical supermarket Product as well as creation of a suitable Class Diagram . 2 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. 2 marks 2 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. 4 + 4 + 4 + 4 + 4 + 4 = 24 marks. i) ii) iiI) iv) v) vi) Total: Contribution to grade (out of 30 marks) Comments: