files.transtutors.com  · web view• the assignment must be in ms word format, 1.5 spacing, 11-pt...

16
Unit Title Programming for Networking Assessme nt Type Assessme nt Title Purpose of the assessment (with ULO Mapping) Individ ual Assignment 2 - OOP 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 testi ng; 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 (2/06/2020) Submissi on Guideli nes 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.

Upload: others

Post on 02-Aug-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: files.transtutors.com  · Web view• 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

Unit Title Programming for NetworkingAssessment Type Assessment TitlePurpose of the assessment (with ULO Mapping)

Individual

Assignment 2 - OOP

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, andtesting;e. Apply basic control structures – sequence, repetition, and selection – to program development;f. Produce simple interactive applications.

Weight 35%Total Marks 80 marksWord limit Not applicableDue Date Week 11 (2/06/2020)SubmissionGuidelines

• 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.

Page 2: files.transtutors.com  · Web view• 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

BN108 Programming for Networking

P a g e | 2

Prepared by: Dr Huma Chaudhry

Moderated by: Mr Min Gurung

March 2020

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.

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 (application.py,

userFunctions.py, contents.py). Program is executed by loading and running the application.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 (add, 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 ten (10) tasks to be completed which are

described next within the modules:

1. application.py

• Task 1: implement menu for the user to login() by entering their id

a. Check if the user is an employee (e) or a student (s).

Page 3: files.transtutors.com  · Web view• 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

BN108 Programming for Networking

P a g e | 3

Prepared by: Dr Huma Chaudhry

Moderated by: Mr Min Gurung

March 2020

Page 4: files.transtutors.com  · Web view• 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

BN108 Programming for Networking

P a g e | 4

Prepared by: Dr Huma Chaudhry

Moderated by: Mr Min Gurung

March 2020

i. If the ID does not belong to either users, prompt ‘invalid id’ and request

input again

ii. Else continue to Task 2

• Task 2: if the user is a student, show them menuStudent ()

• Task 3: if the user is a staff member, show them menuStaff ()

2. userFunctions.py

• Task 4: implement load_vm():

• Task 5: implement add_item():

a. Employee can add new items in the Vending Machine.

b. Search for an item with itemID by Implementing search () function:

def search(itemID):

for i in items:

if(i.itemID==itemID):

return i

c. Employee can add a new content in the items of a vending machine

d. Increase the quantity of items in a slot.

addingItem.quantity+= quantity

Search for slot with itemID A2

Task: Add 4 water bottles in itemID=A2

If slot with itemID is not present then

do not proceed

itemID is found

Item ID exists. pass this object, add a new

water bottle

VendingMachineobject

itemID: "A2" price: $12

Insert 4 new Water item in this list

by increasing

the quantityitemName: ["Water"]

quantity: 1

"A2"$12

["Water"]5

Figure 2: Framework for how an item can be added.

Page 5: files.transtutors.com  · Web view• 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

BN108 Programming for Networking

P a g e | 5

Prepared by: Dr Huma Chaudhry

Moderated by: Mr Min Gurung

March 2020

• Task 6: 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 3. Slot for water bottles is identified by itemID: A2.

Figure 3: A sample vending machine with slot for ItemID: A2

a. Display itemPrice to be paid by the user. Implement calculate(price).

i. If the user is a student, they will get 20% off on the itemPrice. i.e. if

the itemPrice is $10, then the new itemPrice for the student should be

$10-(20/100)*10= $8.

ii. If the paid amount is equal to item price, display “Successful” on the screen.

iii. If the paid amount is more than the remaining item price, calculate change

and display the message: “Your change is: $xyz”

iv. If the paid amount is less than the item price, display the balance which

needs to be paid.

v. (BONUS TASK)1 Start a timer of 20 seconds and wait for user input. If time is

out, display Task 1. If the balance has been paid within 20 sec. display

“Successful” on the screen.

b. Remove the item from the list of items- item has been sold. (Hint- the quantity will

reduce.)

1(Task 4a. is bonus task. You may skip it and only do 4b).If you use the timer function and let the timer run for 20 second only, followed by displaying main Menu (Task 1), you will begranted 2 extra marks! ☺

Page 6: files.transtutors.com  · Web view• 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

BN108 Programming for Networking

P a g e | 6

Prepared by: Dr Huma Chaudhry

Moderated by: Mr Min Gurung

March 2020

• Task 7: Implement disp() to display all the items in the VM

• Task 8: Implement quit_vm() to exit the session.

3. contents.py

• Task 9: implement the class VendingMachine (itemID, itemPrice, itemName, quantity)

i. Draw a UML model of all classes and add it in the report

• Task 10: Demonstrate

Page 7: files.transtutors.com  · Web view• 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

BN108 Programming for Networking

P a g e | 7

Prepared by: Dr Huma Chaudhry

Moderated by: Mr Min Gurung

March 2020

Description of Program functions

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. For employees, 4 menu options are

available to allow the employees to buy, add, display and exit the programs.

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 staff (menu for staff): User enters e123.

Option E2 (Add a new item to an itemID):

Page 8: files.transtutors.com  · Web view• 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

BN108 Programming for Networking

P a g e | 7

Option E3 (Display and check if the quantity has changed):

Prepared by: Dr Huma Chaudhry

Moderated by: Mr Min Gurung

March 2020

Option E1 (Buy an item): No tice that t he em plo yee doesn’t get any disco unt.

Page 9: files.transtutors.com  · Web view• 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

BN108 Programming for Networking

P a g e | 8

Prepared by: Dr Huma Chaudhry

Moderated by: Mr Min Gurung

March 2020

User is a student (menu for student): user enters s123

Option S1 (buy an item A1): User enters S1.

Option S2 (Display): User enters S2. Note that 1 item from A1 has been bought. The quantity is reduced by 1.

Page 10: files.transtutors.com  · Web view• 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

BN108 Programming for Networking

P a g e | 9

Prepared by: Dr Huma Chaudhry

Moderated by: Mr Min Gurung

March 2020

Option S1 (Buy when the quantity is 0): User enters S1

Option S3 (Exit Program): User enters S3

Page 11: files.transtutors.com  · Web view• 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

BN108 Programming for Networking

P a g e | 10

Marking criteria:

Prepared by: Dr Huma Chaudhry

Moderated by: Mr Min Gurung

March 2020

Marking criteria is shown in following table. Marks are allocated as follows:

Description of criteria Max marks

Marks obtained

Implementation of Python functions (50 marks)Task 1: Login : design and functionality 5Task 2: Menu for student: design and functionality 5Task 3: Menu for Staff: design and functionality 5Task 4: Load VM with one more itemID: design and

5 functionalityTask 5: Add item by employee: design and functionality 5Task 6: Buy item by employee and staff: design and 5

functionalityTask 7: Display VM contents: design and functionality 5Task 8: Exit VM: design and functionality 5Task 9: Class VirtualMachine: design and functionality 5Task 10: DEMO 5

Report (15 marks)Program overview 5Screen shots of the program output (Task 1 – Task 9) 5UML model of a VM class from Task 9 5

Others (15 marks)Use whitespace/layout properly to make program more 5 readableYour program compiles successfully without any errors 5 including validation checksIncludes comments for all the functions implemented 5

Total 80

Total 35%

Page 12: files.transtutors.com  · Web view• 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

BN108 Programming for Networking

P a g e | 11

Marking Rubric for Assignment #: Total Marks 80

Prepared by: Dr Huma Chaudhry

Moderated by: Mr Min Gurung

March 2020

GradeMark

HD64-80

D56-63

CR48-55

P40-47

Fail<40

Excellent Very Good Good Satisfactory UnsatisfactoryImplementati on of Python functions

/50

Report/15

Others

/15

Design and implementation is well done and consistent with the task requirements.

Presentation, structure and the content (UML and Screen outputs) of the report is well done and consistent with the task requirements.

Code layout, comments, meaningful variable names & compilation: well done and consistent with the tasks requirements

Design and implementation is consistent with the mostof the taskrequirements. Presentation, structure and the content of the report is consistent with the taskrequirements.Some test cases are missing. Code layout, comments, meaningful variable names& compilation:very good and consistent with the tasks requirements

Design and implementati on is mostly consistent with the task requirements. Presentation,structure andthe content of the report is mostly consistentwith the task requirements.

Code layout, comments, meaningful variable names & compilation: generallyconsistent but can improve

Design and implementation misses on some task requirements

Presentation, structure and the content of the report misses on some task requirements

Code layout, comments, meaningful variable names& compilation: Some inconsistencies with the requirements

No attempted or implementation is incorrect

Not attempted or implementation is incorrect

Code layout, comments, meaningful variable names& compilation: poor effort and program fails to compile