Lecture notes for the Introduction to Computer Science for non-majors by James Tam Return to the course web page

CPSC 217: Assignment 6 (Worth 8%)

New concepts to be applied for the assignment

  1. Program design
  2. Problem solving
  3. 1D arrays/lists

 

Writing a salary management program

For this assignment you are to write a program that allows a manager to track and manage a list of employee salaries for a small company.  The full version of the program will allow the user to: enter a set of salaries, display the salaries of all employees as well and show some statistics about the pay scales.

 

Features to be implemented (you will also be graded on other criteria such as coding style and providing program documentation as listed in the marking key):

Basic features

 

Similar to the previous assignments your program will display an introduction and conclusion when appropriate. The array will be created with each element set to some default starting value (such as zero). Next the program will prompt the user to enter in each salary checking that no invalid values have been entered.  An invalid value would be a salary that is negative or one that exceeds $99,999 (six figure salaries require special approval and won't be tracked by this program).  If such a value has been entered the program will display an appropriate error message and it will continue to prompt the user for the salary until a valid value has been entered.  You can assume that the salaries that will be entered will be whole numbers only. Finally the program will show all employee salaries onscreen. Although you do not have to make your output identical to the one in the sample program it should be neat and presentable in order for you to get credit for your work.

Additional features

 
  1. Compute the average salary: calculate the mean employee salary and display it onscreen.

 
  1. Find the lowest paid employee: find the lowest salary in the list and display it onscreen.
 
  1. Find the highest paid employee: find the highest salary in the list and display it onscreen.
 
  1. Increase the number of salaries that can be tracked from 10 to 100.  In order for you to receive credit for this extra feature you must hand in two versions of your assignment, one with a list of 10 elements and another with a list of 100 elements.  Except for the size of the list the programs should otherwise be identical. You cannot simply create one version of the program that works with only 100 employees. (JT's Hint: There is a hard way of doing this an and easy way.  Think back the lectures when I first talked about writing programs and good style for a clue as to what the easy way is).

 
  1. Determine the number of employees that fall within different salary ranges:  the program will count the number of employees that fall within each of the following ranges:
    Salary range
    Less than $20,000
    $20,000 to less than $40,000
    $40,000 to less than $60,000
    $60,000 to less than $80,000
    $80,000 and above

Resources available

In the course directory under the path: /home/courses/217/assignments/assignment6 you will find an executable program called "salary". Similar to the executable for the previous assignment you can run (execute) it but it cannot be viewed or copied.

 

Submission requirements

In addition to having fulfill the generic assignment requirements, the requirements specific to this assignment include:

 
  1. Include a README file in your submission:  For this assignment you need to include a file called 'README' which includes your contact information: your name, university identification number and UNIX login name so that your marker knows whose assignment that he or she is marking.  Also your README should also list which features of the assignment that you completed (in the case of this assignment which functions did you actually implement).

 
  1. The programming assignments require a two part submission: a) A paper submission of your README file and Python program into the assignment drop boxes (second floor Math Sciences) b) An electronic submission (again of your README file and your Python program) as an email attachment (don't cut and paste it into the email body!) to the following people (failing to include everyone listed below may result in your assignment not being marked for credit so before submitting your assignment double check!) Make sure that the subject line of the email contains the exact text (don't add or delete anything to it or you will lose marks): CPSC 217 Assignment X.

X = The appropriate assignment number (e.g., for Assignment 3 the subject would be titled "CPSC 217 Assignment 3")

 
  1. The course instructor at the following email address: tamj@cpsc.ucalgary.ca
 
  1. Your tutorial instructor, the email addresses for the TA's can be found on the main course web page.
 
  1. The TA coordinating the marking of assignments: amaobied@ucalgary.ca (if you are in Ahmed's tutorial you don't have to send your assignment to him twice, other students must send their assignment both to their TA and to Ahmed).
 
  1. Yourself. Sending the assignment to yourself provides one last "double check" that you submitted your assignment properly (e.g., you sent it to all the right people, you attached all the important files to the submission etc.) When you receive the submitted assignment you can check one last time to make sure that you fulfilled all the requirements. If you forgot something then you can resend your assignment with a note to mark only the latest submission (but try not to resubmit your assignment too many times please).
 
  1. As a reminder, you are not allowed to work in groups for this class.   Copying the work of another student will be regarded as academic misconduct (cheating).  For additional details about what is and is not okay for this class please refer to the following link.
 
  1. For this assignment you must include a structure chart that outlines the functions that will be implemented in your program as well as the hierarchy of function calls (which function calls which). You can work on the structure charts on your own time and during the first tutorials (either Monday or Tuesday of the week of March 31 - April 4) you will get some feedback about the direction of the design of your program. You can hand in your structure charts during the first tutorial that week and you will get written feedback from your TA in the second tutorial about your design. If students hand in their structure charts after this first tutorial (e.g., you hand it in with your paper print outs when you submit your assignment) then you can still get a grade for this component although you obviously won't receive timely feedback to help you with your work. If you are unsure of what a structure chart looks like you can refer to the slides and your in-class notes on problem decomposition / modular design.
To help make sure that you haven't missed anything here is a checklist of items to be used in marking.