Anne Dawson: CSCI120A_LAB3B_FA08.htm
Last updated: Sunday 21st September 2008,
8:19 PT
Fall 2008
This lab is not an assessed lab, i.e.
it will not be marked.
You can ask for help at any time.
Complete as much as you
can in class time,
then upload the file to the network folder:
CSCI on Pineapple\Anne
Dawson\CSCI120A\Week03\LAB3B
by end of class today -
If you don't complete the
assignment in class time,
try to complete it at
home.
Lab
Assignment 3B
Step 1
Study
the following:
Note: you
don't type in the code of your program until Step 3.
An employee
is paid at a rate of $20.75 per hour for regular hours worked in a week.
Regular hours are up to and including 40 hours per week. Any hours in a week worked over regular
hours are paid at the overtime rate of time and a half (i.e. $20.75 x 1.5 per
hour). The gross pay is calculated according to the number of hours worked in a
week. Added to the gross pay for each employee each month is the sum of $54
which each single employee pays for their Medical Services Plan (MSP). If the
employee is married, $36 is added to the gross pay for MSP instead of $54.
From
the gross pay there are a number of deductions per month:
20% of
gross pay is deducted for federal income tax (FIT).
5% of
gross pay is deducted for Canada Pension Plan (CPP).
A lump
sum of $75 is deducted for Extended Medical Insurance (EMI).
Your
program should allow the user to enter the employee's name, their marital
status (single or married) and the number of hours worked in each of the four
weeks of the month. The number of hours can include a fractional part, e.g.
36.9. Your program calculates and displays the gross pay based on the total
hours worked each week (rounded to the nearest integer, e.g. 36.9 is rounded to
integer 37) and includes the MSP payment. The program calculates and displays
the value of each of the deductions. Finally, the program displays the net
salary (the take-home pay) for the employee which is calculated from gross pay
minus deductions.
Step 2
Design
an algorithm (the steps to solve the problem). You should have the algorithm
approved by your instructor before going on to the next step.
The
following web page will help you design your algorithm.
Step 3
Using
your algorithm as a guide, implement your program in the Python language. Use
the IDLE GUI to edit and run your program:
Your
program should start with a comment block that contains the following
information:
#
File:
yourstudentnumber.py
#
Purpose: Lab3B - Payroll Calculations
#
Programmer: your name
#
Course: CSCI120A
#
Date:
Wednesday 24th September 2008
# Algorithm:
# Test
data:
Please
note: any lines in a Python program that start with the # symbol are known as comments. Comments are ignored when the program
runs, but are useful when we read a program, because they supply information about
the program. They are always used
at the top of a program to supply information about the purpose of a program,
its file name, the programmer etc, as shown above. They are also used in the
body of a program to explain parts of the program which may be hard to
understand. Example programs in this course will demonstrate the correct use of
comments. You are expected to supply the above set of comments (updated
appropriately) for all of your lab and homework programming assignments.
Step 4
Test your program by running supplying
your own test data. You should test your program with at least 3 sets of test
data. Show your test data and results in comments at the top of your program.
Step 5
Before the end of the class, follow these
instructions to copy your program file (yourstudentnumber.py) - (just
your Python file - no folders please), to :
CSCI on
Pineapple\Anne Dawson\CSCI120A\Week03\LAB3B
The following
marking scheme is just a guide to illustrate how this program would be marked
if it was an assessed lab. Note
that 65% of the points are awarded for design and style. Only 35% of the marks are awarded for a
complete and tested program!
Marking
Scheme: CSCI120A - Lab 3B - Payroll
Calculations
Marking
Scheme
|
Category |
Points |
Description |
|
10 |
The program should be commented as specified in this document. |
|
|
30 |
An informal description of the
steps that must be taken to solve the problem. The algorithm should be
included in comments in your source code file (studentnumber.py). |
|
|
Output |
10 |
Screen prompts and results should be user-friendly. |
|
Correctness |
10 |
The program should do what is required. |
|
Completeness |
10 |
The program should be complete. |
|
Style |
15 |
The source code should use meaningful variable names. |
|
Test |
15 |
Comments in the code explain
how the code was tested. |