a
BN108Programming for NetworkingPage | 11 Assessment Details and Submission Guidelines Trimester T1 2021 Unit Code BN108 Unit Title Programming for Networking Assessment Type Individual Assessment Title Assignment 2 - Programming for a Vending Machine Purpose of the assessment (with ULO Mapping) This assignment assesses the basic concepts of programming; students should be able to demonstrate their achievements in the following unit learning outcomes: a. Describe the fundamental principles of object-oriented programming; b. Interpret a user’s needs while dealing with simple program specifications; c. Design a simple class using UML notation; d. Create a simple application based on UML design and the incremental development process of coding, debugging, and testing; e. Apply basic control structures – sequence, repetition, and selection – to program development; f. Produce simple interactive applications. Weight 35% Total Marks 80 marks Word limit Not applicable Due Date Week 11 (3/06/2021) Submission Guidelines · All work must be submitted on Moodle by the due date along with a completed Assignment Cover Page. · The assignment must be in MS Word format, 1.5 spacing, 11-pt Calibri (Body) font and 2 cm margins on all four sides of your page with appropriate section headings. · Reference sources must be cited in the text of the report, and listed appropriately at the end in a reference list using IEEE referencing style. Extension If an extension of time to submit work is required, a Special Consideration Application must be submitted directly on AMS. You must submit this application three working days prior to the due date of the assignment. Further information is available at: https://www.mit.edu.au/about-us/governance/institute-rules-policies-and-plans/policies-procedures-and-guidelines/assessment-policy Academic Misconduct Academic Misconduct is a serious offence. Depending on the seriousness of the case, penalties can vary from a written warning or zero marks to exclusion from the course or rescinding the degree. Students should make themselves familiar with the full policy and procedureavailable at: http://www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure. For further information, please refer to the Academic Integrity Section in your Unit Description Assignment 2 Title: Programming for a Vending Machine Assignment Description: This assignment will give you practice with interactive programs, if/else statements, list and classes. You are required to submit a report as mentioned in the marking guide. Also, a 5 min demonstration recording must be submitted with the required files: 1. Python scripts, 2. Report, 3. 5 Min demo video. Problem Description MIT has decided to create a new vending machine. The machine needs to be programmed in Python for its embedded system. This vending machine application must keep records of items in stock. Details of each item shall include "Item ID","Price","Quantity","Item Name". Figure 1: An overview of the Vending Machine and its contents’ description Task Requirements Imagine you have been invited to develop a menu driven Python application to manage records of items in stock of the vending machine. Based on the problem description, starter program (code template) has been provided. Investigate the provided starter program. There are 3 scripts (applicationRun.py, userFunctions.py, contents.py). Program is executed by loading and running the applicationRun.py. Driver function (main) is defined in the appliction.py, which imports userFunctions module (userFunctions.py). userFunctions module (userFunctions.py ) declares all the core functions (display, buy, search, etc) for supporting the Vending Machine. The userFunctions module imports contents module (contents.py). Note: most of these functions, although declared and wired up in the program are not yet implemented. Your task is to implement these functions. There are five (5) tasks to be completed which are described next within the modules: 1. Design: Three main parts of the program perform the following tasks: · Authenticate login. · Display Vending machine contents · Allow purchase a. The first part of the program, which authenticates User ID from Database, is a loop. Design the program algorithm for the first part with the help of pseudocode. b. The third part of the program takes user input for the item user wishes to purchase. If the item is not in the VM, user must be notified to try again. If the item is present in the VM, then item must be sold by quoting the item price. Once the item price is completely paid, then the quantity present in the VM must be reduced by 1. Analyse the third part and structure a Flow Chart for this process. c. Design a simple VendingMachine class using UML notation. 2. Implementation: Module: applicationRun.py · Task 1: implement menu for the user to login() by entering their id Check if the user is authentic. a. If the ID does not match to the Data Base in db.txt file, prompt ‘invalid id’ and request input again b. Else , show them menu for students Module: userFunctions.py · Task 2: implement load_vm(): Initializse VM with some items. · Task 3: Display contents of the Vending Machine. · Task 4: Implement buy_item() Take input from the user for itemID. E.g. User input: A2 has 3 items in the stock with the price $2. You should confirm if the itemID is present. ItemID is the ID for a slot in the machine. Refer to Figure 2. Slot for water bottles is identified by itemID: A2. Figure 2: A sample vending machine with slot for ItemID: A2 Display itemPrice to be paid by the user. Implement calculate(price). a. If the paid amount is equal to item price, display “Successful” on the screen. b. If the paid amount is more than the remaining item price, calculate change and display the message: “Your change is: $xyz” c. If the paid amount is less than the item price, display the balance which needs to be paid. Remove the item from the list of items- item has been sold. (Hint- the quantity will reduce by 1.) buyObject.quantity - = 1 Module: contents.py · Task 5: Complete the class VendingMachine (itemID, itemPrice, itemName, quantity). · Description of Program functions and Testing: Program asks user to login and displays a corresponding menu on execution. For students, 3 menu options are available to allow the student to buy, display, and exit program. Program functionality and screen output for each of the menu option upon selection by the user are shown: Program menu on execution: User is a student (menu for student): user enters s123 Option S1 (buy an item A1): User enters 1. Option S2 (Display): User enters 2. Note that 1 item from A1 has been bought. The quantity is reduced by 1. Option S1 (Buy when the quantity is 0): User enters 1 Option S3 (Exit Program): User enters 3 Marking criteria: Marking criteria is shown in following table. Marks are allocated as follows: Description of criteria Max marks Marks obtained Design (30 marks) Pseudocode 10 FlowChart 10 UML 10 Implementation of Python functions (30 marks) Task 1: Login : design and functionality 5 Task 2: Load VM with one more itemID: design and functionality 5 Task 3: Display VM contents: design and functionality 5 Task 4: Buy item: design and functionality 5 Task 5: Class VirtualMachine: design and functionality 5 DEMO (5 min zoom recorded Video demonstration) 5 Report (10 marks) Program overview 2 Screen shots of the program Testing output 5 Paste code into report 3 Others (10 marks) Use comments, whitespace/layout properly to make program more readable 2 Demonstration 5 min video 8 Total 80 Total 35% Marking Rubric for Assignment #: Total Marks 80 Grade Mark HD 64-80 D 56-63 CR 48-55 P 40-47 Fail <40 excellent very good good satisfactory unsatisfactory design /30 algorithm and flow chart have been well designed. all scenarios have been covered algorithm and flow chart have been well designed. most of the scenarios have been covered algorithm / flow chart has been designed but only a few scenarios have been covered one of the designs is missing from algorithm and flow chart algorithm and flow chart have been poorly designed or are missing. implementation of python functions /30 design and implementation is well done and consistent with the task requirements. design and implementation is consistent with the most of the task requirements. design and implementation is mostly consistent with the task requirements. design and implementation misses on some task requirements no attempted or implementation is incorrect report /10 presentation, structure and the content (uml and screen outputs) of the report is well done and consistent with the task requirements. presentation, structure and the content of the report is consistent with the task requirements. some test cases are missing. presentation, structure and the content of the report is mostly consistent with the task requirements. presentation, structure and the content of the report misses on some task requirements not attempted or implementation is incorrect others /10 code layout, comments, meaningful variable names & compilation: well done and consistent with the tasks requirements and demo code layout, comments, meaningful variable names & compilation: very good and consistent with the tasks requirements code layout, comments, meaningful variable names & compilation: generally consistent but can improve code layout, comments, meaningful variable names & compilation: some inconsistencies with the requirements code layout, comments, meaningful variable names & compilation: poor effort and program fails to compile prepared by: dr huma chaudhry moderated by: a/prof paul kwanapril, 2021 prepared by: dr huma chaudhry moderated by: a/prof paul kwanapril 2021 mit123456 mit654321 mit111111 excellent="" very="" good="" good="" satisfactory="" unsatisfactory="" design="" 30="" algorithm="" and="" flow="" chart="" have="" been="" well="" designed.="" all="" scenarios="" have="" been="" covered="" algorithm="" and="" flow="" chart="" have="" been="" well="" designed.="" most="" of="" the="" scenarios="" have="" been="" covered="" algorithm="" flow="" chart="" has="" been="" designed="" but="" only="" a="" few="" scenarios="" have="" been="" covered="" one="" of="" the="" designs="" is="" missing="" from="" algorithm="" and="" flow="" chart="" algorithm="" and="" flow="" chart="" have="" been="" poorly="" designed="" or="" are="" missing.="" implementation="" of="" python="" functions="" 30="" design="" and="" implementation="" is="" well="" done="" and="" consistent="" with="" the="" task="" requirements.="" design="" and="" implementation="" is="" consistent="" with="" the="" most="" of="" the="" task="" requirements.="" design="" and="" implementation="" is="" mostly="" consistent="" with="" the="" task="" requirements.="" design="" and="" implementation="" misses="" on="" some="" task="" requirements="" no="" attempted="" or="" implementation="" is="" incorrect="" report="" 10="" presentation,="" structure="" and="" the="" content="" (uml="" and="" screen="" outputs)="" of="" the="" report="" is="" well="" done="" and="" consistent="" with="" the="" task="" requirements.="" presentation,="" structure="" and="" the="" content="" of="" the="" report="" is="" consistent="" with="" the="" task="" requirements.="" some="" test="" cases="" are="" missing.="" presentation,="" structure="" and="" the="" content="" of="" the="" report="" is="" mostly="" consistent="" with="" the="" task="" requirements.="" presentation,="" structure="" and="" the="" content="" of="" the="" report="" misses="" on="" some="" task="" requirements="" not="" attempted="" or="" implementation="" is="" incorrect="" others="" 10="" code="" layout,="" comments,="" meaningful="" variable="" names="" &="" compilation:="" well="" done="" and="" consistent="" with="" the="" tasks="" requirements="" and="" demo="" code="" layout,="" comments,="" meaningful="" variable="" names="" &="" compilation:="" very="" good="" and="" consistent="" with="" the="" tasks="" requirements="" code="" layout,="" comments,="" meaningful="" variable="" names="" &="" compilation:="" generally="" consistent="" but="" can="" improve="" code="" layout,="" comments,="" meaningful="" variable="" names="" &="" compilation:="" some="" inconsistencies="" with="" the="" requirements="" code="" layout,="" comments,="" meaningful="" variable="" names="" &="" compilation:="" poor="" effort="" and="" program="" fails="" to="" compile="" prepared="" by:="" dr="" huma="" chaudhry="" moderated="" by:="" a/prof="" paul="" kwan="" april,="" 2021="" prepared="" by:="" dr="" huma="" chaudhry="" moderated="" by:="" a/prof="" paul="" kwan="" april="" 2021="" mit123456="" mit654321="">40 excellent very good good satisfactory unsatisfactory design /30 algorithm and flow chart have been well designed. all scenarios have been covered algorithm and flow chart have been well designed. most of the scenarios have been covered algorithm / flow chart has been designed but only a few scenarios have been covered one of the designs is missing from algorithm and flow chart algorithm and flow chart have been poorly designed or are missing. implementation of python functions /30 design and implementation is well done and consistent with the task requirements. design and implementation is consistent with the most of the task requirements. design and implementation is mostly consistent with the task requirements. design and implementation misses on some task requirements no attempted or implementation is incorrect report /10 presentation, structure and the content (uml and screen outputs) of the report is well done and consistent with the task requirements. presentation, structure and the content of the report is consistent with the task requirements. some test cases are missing. presentation, structure and the content of the report is mostly consistent with the task requirements. presentation, structure and the content of the report misses on some task requirements not attempted or implementation is incorrect others /10 code layout, comments, meaningful variable names & compilation: well done and consistent with the tasks requirements and demo code layout, comments, meaningful variable names & compilation: very good and consistent with the tasks requirements code layout, comments, meaningful variable names & compilation: generally consistent but can improve code layout, comments, meaningful variable names & compilation: some inconsistencies with the requirements code layout, comments, meaningful variable names & compilation: poor effort and program fails to compile prepared by: dr huma chaudhry moderated by: a/prof paul kwanapril, 2021 prepared by: dr huma chaudhry moderated by: a/prof paul kwanapril 2021 mit123456 mit654321 mit111111>