程序代写代做代考 python case study algorithm Page 1 of 9

Page 1 of 9

Qualification New Zealand Diploma in Web Development and Design

Course 5002 Fundamentals of Programming and Problem
Solving

Level 5

Assessment Number 1 (Assignment)

Assessment Version V1

Semester & Year S2, 2018

Campus Auckland

Assessment Date Time allowed/Due
Date

Submission type

Assignment 31/Oct/2018 Due: 2:30 pm,
Tuesday. 27

November 2018

Upload your files to Moodle in a
zipped folder

Learning
Outcomes

1. Apply programming concepts and tools to system management
tasks.
2. Demonstrate awareness of procedural and object oriented
programming.
3. Apply principles of implementation (user testing, deployment).
4. Demonstrate programming using core logic and mathematical
concepts such as problem solving methods, critical thinking,
abstract reasoning; and systems thinking.

Total
Weighting

100%

Learning Outcome Task Marks Available Weighting Marks
Awarded

1 1 20 20% /20

4 2 20 20% /20

2,4 3 20 20% /20

2,4 4 20 20% /20

3 5 10 10% /10

2,4 6 10 10% /10

Total marks

100 100% /100

Page 2 of 9

Tutor/Assessor

Marks: Grade:

Assessment Instructions:

 This is an individual project. It must be your own work.
 Do not copy the source codes or project of others.
 Complete the student declaration and submit it as part of your answer
 Complete all tasks.
 Take note of the due date/time to complete. If you have circumstances that

mean you cannot complete the work on time discuss it with your tutor before
the due date.

 Work submitted after due date, without prior negotiation with the tutor or
programme leader will not be marked. (Please, refer to NZDSD, NZDWDD
programme regulations).

 The name of your project Folder should be labelled by your student ID.

STUDENT DECLARATION

I declare that this is my own work.

If this assessment is submitted electronically I understand that by entering my student
ID below, this declaration will be deemed to have the same authority as a signed

statement.

Student ID:

Date:

Page 3 of 9

Assessment Requirements
This assignment covers all learning outcomes. You are required to use both procedural and

object-oriented programming principles to develop the applications of the case study

provided below. You are required to elaborate the requirements of the application through

applying tools like pseudocode, flow chart, and algorithm before implementing your case

study in Python. To ascertain data entry integrity of the application, use any appropriate

validation techniques to validate the input data. Moreover, you have to write your test cases

for each of the classes by using test runner (unittest) capability of Python.

Case Study

SmallDuty is a New Zealand IT company pays its employees on a weekly basis. The employees
are categorised in four categories:

 Salaried employees are paid a fixed weekly salary regardless of the number of hours
worked,

 Hourly paid employees are paid by the hour and receive overtime pay (i.e., 1.5 times their
hourly salary rate) for all hours worked more than 40 hours,

 Commission only employees are paid a percentage of their sales and

 Base-salaried commission employees receive a base salary plus a percentage of their
sales.

For the current pay period, the company has decided to reward salaried-commission
employees by adding 10% to their base salaries. The company wants you to write an
application that performs its payroll calculations polymorphically.

Page 4 of 9

TASKS:

Part 1 (20 marks)
1. Illustrate OS module of the Python? How it provides a way of using operating system

dependent functionality? Implement the given commands in Python with the proper
justifications of the scenarios when they are required? [LO1]

a. os.getcwd()
b. os.getgid()
c. os.getlogin()
d. os.access()
e. os.getsize()

Part 2 (20 marks)

2. Generate pseudocode, algorithm and flow chart for the above given case study and
explain how they may help you in the actual implementation of the proposed
applications? [LO4]

Part 3 (20 marks)

3. Write the applications in Python, use both procedural and Object-Oriented Programming
techniques such as – encapsulation, inheritance, information hiding and polymorphism.
These techniques should be evident in your programming style.

To implement the case study you are to create a general abstract superclass for all the
employees called Employee. All the four categories of employees should inherit from this
abstract class.
Hint: In order to do that create subclasses named, SalariedEmployee, HourlyEmployee,
CommissionEmployee, of the abstract class Employee. These subclasses should extend
from the Employee abstract class.
Create a BasedPlusCommissionEmployee subclass of CommissionEmployee class.
[LO2,4]

Note: you must add comments to the code (methods, classes, variables).

Part 4 (20 marks)

4. Apply the validation of the data using the exception handling or if-else statements to

validate input data. Write your application to validate the following data input.
a. If the user enters weekly salary less than 0.0, the programme should prompt the user

that weekly salary should be greater than 0.0.
b. Ensure that for hourly wage employees’ hours worked is between 0 – 65 hours (total

hours of a week). Also, the wage per hour is not less than $16.50 (minimum wage).
Error message

c. Also, the commission of commission only employees entered should not be more than
100%.
[LO2, 4]

Page 5 of 9

Note: you must add comments to the code (methods, classes, variables).

Part 5 (20 marks)

5. To test the applications, write test cases for each of the classes by using python Test

runner (unittest). Every class must have at least one pass and fail scenarios. [LO3]

Part 6 (10 Marks)

The output of your project should appear as the following (LO2, 4)

Employees processed individually:

salaried employee: John Smith
IRD Number: 102-034-506
weekly salary: $ 800.00
earned: $800.00

hourly employee: Karen Price
IRD Number: 113-145-106
hourly wage: $ 16.75, hours worked: 40.00
earned: $670.00

commission employee: Sue Jones
IRD Number: 103-040-606
gross sales: $ 10,000.00; commission rate: 0.06
earned: $600.00

base-salaried commission employee: Bob Lewis
IRD Number: 104-020-305
gross sales: $ 5,000.00; commission rate: 0.04; base salary: $300.00
earned: $500.00

Employees processed polymorphically:

salaried employee: John Smith
IRD Number: 102-034-506
weekly salary: $ 800.00
earned $800.00

hourly employee: Karen Price
IRD Number: 113-145-106
hourly wage: $ 16.75, hours worked: 40.00
earned $670.00

commission employee: Sue Jones
IRD Number: 103-040-606
gross sales: $ 10,000.00; commission rate: 0.06
earned $600.00

base-salaried commission employee: Bob Lewis
IRD Number: 104-020-305
gross sales: $ 5,000.00; commission rate: 0.04; base salary: $300.00
earned $530.00

Employee 0 is a Employee.SalariedEmployee
Employee 1 is a Employee.HourlyEmployee
Employee 2 is a Employee.CommissionEmployee
Employee 3 is a Employee.BasePlusCommissionEmployee

Page 6 of 9

Page 7 of 9

Assignment Deliverables (100 marks)

Contents of Assignment Portfolio Your assignment folder should include:

Part Criteria Max Marks

(sub-parts)

Given

Marks

(Sub-Parts)

Total

Marks

(Part)

Given

Marks

(Part)

1 Illustrate OS module of the Python?
How it provides a way of using
operating system dependent
functionality? Implement the given
commands in Python with the proper
justifications of the scenarios when
they are required? [LO1]

a. os.getcwd()
b. os.getgid()
c. os.getlogin()
d. os.access()
e. os.getsize()

 Illustration of OS Module

 Implementation of given commands

with proper justification (1 mark for

justification and 1 mark for

implementation)

1 X 10=10

2 x5 =10

20

2 Generate pseudocode, algorithm and

flow chart for the above given case

study and explain how they may help

you in the actual implementation of the

proposed applications?

 Pseudocode with explanation (4 + 2

marks)

 Algorithm with explanation (5 +2

marks)

 Flow chart with explanation (5 + 2

marks each)

1×6=6

1 x7=7

1×7=7

20

3 Write the applications in Python  Create Five Classes (1 mark each)

 Declare the data in the classes (1

marks each)

1 x 5 =5

1 x 5=5

20

Page 8 of 9

 Implement a method in the classes

(1 mark each)

 Good indentation of codes. (2

marks)

 Commenting on methods, classes

and variables. (3 marks)

1 x 5=5

1 x 2=2

1 x3=3

4 Validation of the data uses the

exception handling or if-else

statements to validate input data.

 Using “IF” AND “Exception

handling” for the five classes. (3

marks each)

 Good indentation of codes. (2

marks)

 Commenting on methods, classes

and variables. (3 marks)

3×5=15

1×2=2

1×3=3

20

5 To test the applications  Test cases for each class (1 x Pass
and 1 x Fail) ( 1 marks for Pass and 1

marks for Fail test cases)

2×5=10 10

6 Output 4 classes (1 mark for each class output),

( 4 marks)

1 mark for polymorphic output, 4
classes ( 4 marks )
2 marks for array output (2 marks)

1×4=4

1×4=4
1×2=2

10

Total /100 /100

Page 9 of 9

Submission instructions:

 You should upload two files

1- Word file include your answers

2- Project (compressed file contain the Python code)

 Submit your zipped folder to Moodle.

 Saving your assignment at the right size is important because large files (over 20MB) can be difficult or impossible to upload.