Python design problem
Payroll
Introduction
This assignment is a design problem, not a coding problem. It is meant to provide you with practice in top-down design with step-wise refinement, that is, the decomposition of a problem into appropriate modules and high level functions definitions. We are looking for a design document, not a working Python 3 program, so do not submit any Python 3 code.
The problem
A company needs a program to generate on-screen reports from their employee database.
The company’s employee records are in files on their computer system. The format of these files (.csv, .json, whatever) is not important to your design. Here is a description of the data contained in the files that are relevant to your project:
A central employees file contains the following information for each employee:
name
employee ID
(other information not needed for reports)
Each employee has a file (with a name generated from the employee’s ID number) that contains up to twelve records of data (one per month) for the current year. Each record contains this information:
The employee’s (unique) ID
The month
The number of hours worked that month by the employee
The employee’s hourly rate of pay for that month.
This file gets updated monthly by an existing program (not yours) with new information.
Here is a list of report types the company wants and for which you’ve been asked to design a program:
A pay report for a user-specified month. The report will have one screen row of data for each employee showing the following:
The employee’s ID.
The employee’s name.
The number of hours worked that month by the employee.
The employee’s hourly rate of pay for that month.
The employee’s pay for that month.*
*Gross pay. Don’t concern yourself with tax, pension, and other deductions.
This report will also contain a summary of pay information, as follows:
Number of employees.
Total pay for all employees.
Average pay per employee.
A year-to-date pay report for a user-specified employee. The report will have one screen row of data for each month of the current year. (Fewer than twelve rows, obviously, if the report is generated before the end of December.) Each row of the report will contain:
A month.
The number of hours worked that month by the employee.
The employee’s hourly rate of pay for that month.
The employee’s pay for that month.
This report will also contain a summary of pay information for the employee, as follows:
Total pay to date for the employee.
Average monthly pay for the employee.
A year-to-date pay summary report for all employees. The report will have one screen row of data for each month of the current year. Each row of the report will contain:
The month.
The total pay for the month.
The average pay per employee for the month.
What you must do
You are to create a top-down design for the problem described above. Your end result should be a listing of modules, descriptions of each modules’ purpose, functions within those modules, and descriptions of each function. Here is a sample of what we expect to see (for a different problem, of course, and recognizing that a real solution that includes a controlling (main) module would be much longer).
Module: build_word_list
< A description of the module’s purpose goes here.>
Functions:
get_words(file_name): Read a file of words into a list.
Parameter:
file_name: The name of the file of words.
Return: A list of words extracted from file file_name.
filter_words(words_list, unwanted_words): Remove duplicate words and words in unwanted_words from words_list.
Parameters:
words_list: A list of words.
unwanted_words: A list of words to be removed from words_list.
Module: anagrams
< A description of the module’s purpose goes here.>
Function:
find_anagrams(all_words_file_name, words_list): Return a two dimensional list of anagrams of the words in words_list. Each anagram is a word found in file all_words_file_name.
Parameters:
all_words_file_name: The name of a file containing all valid words.
words_list: The list of words.
Return: A two-dimensional list of words, each row of which is a list of anagrams of words from the corresponding row of words_list.
Note: Your design should make clear which function in which module serves as the starting point for your program’s execution
The post Python design problem appeared first on Savvy Essay Writers.
Leave a Reply
Want to join the discussion?Feel free to contribute!