Case Study Solutions
This appendix contains the solutions to the Acme Mining Company Case Study.
The Acme Mining Company
Rewritten Problem Statement
Note – The candidate classes and objects have been underlined.
The Acme Mining Company requires a computerized payroll system. They need the system to operate on two planets where they currently trade. Planet Earth and the Planet Zog are the locations, each has a differing currency with different tax and deduction policies.
Pay is calculated periodically, this is currently monthly and weekly dependant on the pay type of the employee.
Currently the pay types are monthly paid, weekly paid and hourly paid employees.
Monthly paid employees have an annual salary divided into twelve equal amounts, these are paid at the end of each month.
Weekly paid employees are paid their weekly rate of pay at the end of each calendar week.
Hourly paid employees have an hourly rate of pay. The hours worked by these employees are determined by a clock in, and clock out time, recorded by a time clock system. The excess hours worked, above the normal site working hours are paid at an overtime rate applicable to their site.
The majority of Acme employees are hourly paid.
The time clock information for hourly employees can be downloaded directly from the time clock. This must be done once every 24 hours. Employees are identified by their name and their employee
identification number only.
Weekly paid and hourly paid employees can elect to be paid in cash or by check. Monthly paid employees can only be paid by cheque. All payments are paid in the local currency applicable to the planet.
These are currently, on Planet Earth, Earth Dollars and on Planet Zog, Zog Groats. Pay is calculated by applying any tax deductions (that apply to the location) to every employee and company deductions that apply to an employee. Taxes are cumulative for the financial year.
The Planet and Country taxes are paid on the gross salary at tiered rates. The Social Security and Pollution taxes are paid on the gross salary and are at a fixed rate. Other deductions applicable are for Health Insurance, which is optional. The Pension Scheme however, is compulsory for all employees. Pensions are deducted at a flat
percentage rate.
Pay rates and employee details can only be recorded and amended by Human Resources. Weekly and Monthly Payroll runs are both initiated by the payroll clerk, it produces payslips itemizing the amount paid and any deductions made to each employee.
It produces a summarized list of payments and deductions made to each employee for each run. This summary shows total deductions collected from all employees for each deduction and tax. After the end of the tax year the Payroll Clerk will request a summary of tax paid by all employees for that tax year.
Current Taxes Applicable: Planet Tax, Country Tax, Pollution Tax, and Social Security Tax.
Planet Earth Taxes: Pollution Tax, Planet Tax, and Country Tax.
Data Dictionary
Word/Phrase Definition
Payroll Run Manually initiated request for
calculations of pay and deductions for each employee applicable to specific run.
Monthly Payroll Run Payroll Run only applicable for monthly employees.
Weekly Payroll Run Payroll Run only applicable for weekly and hourly employees
Employee I.D. Number
A number uniquely identifies the employee within the company Zog Groats Currency applicable to Planet Zog Earth Dollars Currency applicable to Planet Earth Time Clock A System which records time for
commencement and completion of employees work hours. Data is stored, it can be printed or downloaded to another system.
Monthly Employee Paid on a monthly basis, dividing the payments into twelve equal
installments
Hourly Employee Paid by hourly rate for each hour worked according to the specific rate allocated to the individual employee. Subject to overtime payment for additional hours worked at company and location rate.
Taxation Tax deductions applied on gross earning. It is a banding system, where tax is paid at a specified rate for earnings up to a band limit. Any income in that band is taxed in the next band, so forth.
Tiered Rate Tax A deduction that is applied at the specified percentage rate on gross earnings.
Percentage Rate Deduction
A fixed amount deducted at every pay period.
Flat Rate Tax
Use Case Scenarios
Monthly Run Scenario I
1. The Payroll Clerk on the Planet Zog selects a Payroll Run.
2. They select the monthly run from the options.
3. All monthly paid employees are selected.
4. The first employee is selected.
5. Their monthly pay is calculated.
6. Their gross pay to date is calculated.
7. Planet Tax is calculated.
8. Social Security Tax is calculated.
9. Pension deduction is calculated.
10. This employee has the health insurance option, so this is calculated.
11. The net pay is calculated.
12. The payslip is printed.
13. All deductions are accumulated.
14. Next Employee is selected,
15. All as above, exception this employee has no Health Insurance
16. No more employees
Monthly Run Scenario 2
1. The Payroll Clerk on the Planet Zog selects a Payroll Run.
2. They select the monthly run from the options.
3. All monthly paid employees are selected.
Add Employee Scenario 1
1. Human Resources on the planet Zog log on to the system.
2. They select enter new employee from the menu
3. New Employee Screen Displayed.
4. The enter employee John Simms for the name and 1023 for the employeeID.
5. System check for identical ID, none found.
6. Further details are requested.
7. They choose the monthly pay type form menu.
8. They are asked to enter monthly salary in Zog Groats.
9. They enter 30500.
10. The are asked to enter starting date.
11. They enter 03/05/2049.
12. They are asked if the employee requires the Health Insurance option.
13. They select Yes.
Add Employee Scenario 2
1. Human Resources on the planet Zog log on to the system.
2. They select enter new employee from the menu
3. New Employee Screen Displayed.
4. The enter employee Peter Smithy for the name and 101 for the employed
5. System checks for identical ID.
6. Identical ID found
Use Case Forms
Use Case Form: Monthly Run
Name Monthly Run
Actor payroll Clerk/Human Resources Priority Low Status To be agreed Extension Points None Extends None
Includes Payroll Run Preconditions/
Assumptions
Post-conditions
Flow of Events 1. Use Case begins when initiated by actor 2. Employees of Type Monthly are selected 3. Include (Payroll Run)
Alternative Paths Non-functional Requirements Performance Frequency Monthly Notes
Use Case Form: Weekly Run
Name Weekly Run
Actor Payroll Clerk Priority High Status To be agreed Extension Points None Extends None
Includes Payroll Run Preconditions/
Assumptions
Post-conditions
Flow of Events 1. Use Case begins when initiated by actor
2. Employees of Type, Hourly are selected.
3. Employee of Type, Weekly are added include (Payroll Run) Alternative Paths Non-functional Requirements Performance Frequency Weekly Notes
Use Case Form: Find Employee
Name Find Employee
Actor payroll Clerk/Human Resources Priority High Status To be agreed Extension Points None Extends None Includes Preconditions/ Assumptions
Has access to I.D. or name
Post-conditions
Makes available Employee Found
Flow of Events 1.Search for Employee Requested. 2.If no Employee Found [A1] 3.Make Employee found available. Alternative
Paths
Report Employee Not Found
Non-functional Requirements Performance
Frequency Notes
Use Case Form: Payroll Run
Name Payroll Run
Actor Payroll Clerk, Payroll Printer Priority High Status To be agreed Extension Points None Extends None Includes None Preconditions/ Assumptions
Calling Use Case has selected a list of Employees for Processing
Post-conditions
Flow of Events 1. The use Case begins during the Weekly Run or Monthly Run Use Case
2. For each Employee in list provided by calling Use Case
a) Create new payslip b) For each Tax, Company Deduction
i) Calculate deduction to be made
ii) Add deduction to payslip iii) Add deduction to running total
c) Print payslip d) Save payslip
3. For each deduction
● Print accumulated total
Alternative Paths
Non-functional Requirements
Performance Not an issue. Treat as Batch Frequency Monthly, Weekly
Notes Reliability is Important
Candidate Object List
Candidate Class/ Objects
Reason for
Elimination Class name
Acme employees Synonym for Employee Acme Mining
Company
Outside of the system
amount paid Attribute Payslip
annual salary Attribute Monthly Paid employee check Attribute
value
Employee
clock in time Attribute TimeClockData clock out time Attribute TimeClockData
company deductions
Attribute Deduction
country tax CountryTax
currency Attribute Location
deduction Attribute Payslip
deduction policies
Method
Earth Dollars Value of currency attribute
employee details Synomyn for Employee employee identification number Attribute Employee
employee type Attribute or class EmployeeType excess hours worked Derived attribute TimeClockData, Location
financial year Synonyn for tax year
flat rate Attribute or class
FlatRate
gross salary Attribute Payslip
health insurance HealthInsuranceDeduction
hourly employees Synonym for hourly paid employees
hourly paid Aynonym for hourly paid employees hourly paid employees Class HourlyPaidEmployee Candidate Class/ Objects Reason for
hourly rate of pay Attribute HourlyPaidEmployee
hours worked Attribute TimeClockData
human resources Actor
list of payments Derived attributes
Payslip
local currency Synonym for currency location Location month Value of time monthly paid employees MonthlyPaidEmployee
name Attribute Employee
normal site working hours
Attribute Location
overtime rate Attribute Location
pay Attribute Payslip
pay rates Attribute Employee
pay type Attribute Employee
Candidate Class/ Objects
Reason for
list of payments Derived attribute
Payslip
payroll clerk Actor
payroll system The
application
payslips Payslip
pension scheme PensionSchemeDeduction
percentage rate deduction
Attribute or class
PercentageRate
Planet Earth Value of location
Planet Tax PlanetTax
Planet Zog Value of location
planet Attribute of Location
pollution tax PollutionTax
site Synonym for location
social security tax SocialSecurityTax
Candidate Class/ Objects
Reason for
system Not relevant
tax deductions Attribute Payslip
tax year Attribute Tax
tiered rates TieredRate
time clock Actor
time clock information
TimeClockData
time clock system Actor
total deductions Attribute Payslip
weekly calculation Synoym for weekly payroll weekly paid employees WeeklyPaidEmployee
weekly payroll Use Case
weekly rate of pay Attribute WeeklyPaidEmployee Candidate Class/ Objects Reason for
Risk Assessment
Risk is a very subjective subject. Here is the author’s simplified risk analysis ( using threerisk categories) with some brief reasoning:
Key
● High risk -reason customer needs to see working software, so
these Use Cases will gives a working product.
● Medium risk -will add some more functionality, and the time interface could be tricky.
Packaging Use Cases By Risk
● If the system was larger, you could do further risk assessment to break into smaller packages.
● In a real project, you would do several iterations in the inception and elaboration phases before moving onto the build iterations.
In this case study, time constraints make it imperative to compress several increments into one.
Activity Diagram
Note – There are alternation notations for showing a loop.They require
nested activities diagrams. See UML documentation for details.
● You could have shown a nested activity diagram for Calculate
Company Deduction, Calculate Tax Deduction, and Print each Deduction.
Adding Inheritance
● Some of these could have been just attribute values. But they differ in behavior or attributes, so you have made them extend a base class.
Additional Classes and Attributes
● You have added new classes and attributes, including an
association class (AmountDeducted), and including a constraint ( theTierRate must be applied in order).
Adding Aggregation & Composition
● You have based the distinction on ownership, e.g. if theTierRate
objects are only needed for one PlanetTax object. When that dies, they die too.
Sequence Diagram I
Monthly Payroll Run
● The details of each deduction has been omitted from here.
Note – This highlighted a missing class from our diagram, namely the
DeductionSummary, so you have added this.
● Alternatively, you could have derived the values from all of the
Timeslips to avoid creating this extra class. However, you would then have had to go back and edit our Use Case Form for
Sequence Diagram II
Sequence Diagram III
For Social Security Tax Calculations
● One of the many alternative Sequence Diagrams for the Monthly
PayrollRun Use Case.
● This one uses some delegation. The Deduction object will add
Sequence Diagram IV
Revised for Monthly Payroll Run
● Shows missing interaction.
State Transition Diagram
For Payslip Class
● It shows that you have missed an important interaction in our
sequence diagram( namely to initialise the pay details ).
● It also highlights that you should ensure that you cannot change the details once saved.
Removing Association Class
● You have removed the association class by putting the class
between the two associated classes .This has removed the many to many relationship.
Revised Logical Packaging
● As the diagrams are getting complicated, you need to look at them
in packages. Here are the two Business Model Packages, and one new Controller Package.
Deduction Logical Packaging
● You have included both Tax and Company Deductions in one
package. This is contrary to the original planned packages.
Employee Logical Packaging
● We have included the location classes here.In practice, they perhaps should be in a separate package.
● One option here would be to delegate the Pay to a PayType,
Monthly, Weekly etc would then inherit from that class, thus making it easy for an Employee to change their PayType.
However this was not in the specification, so you will not complicate the diagram here.
Miscelleanous Notes and Changes
● The attribute monthlyCharge PensionDeductions was changed to
annualCharge, so it can apply to different Employees Pay Types.
● The Domain expert points out that the SiteOverTimeRate will
change, therefore you need to record the date of the change and store a list.
● Having decided to keep the Employee as the base class for
different types, you will end up with this being abstract.
● The scoped down problem doesnt need to keep a history of salary
changes, or timeslips. So once pay is processed the Timeslip objects are destroyed.
● The hours works are integral. ● Payslip objects do need to be kept.
Adding Delegation
● The classCompanyDeduction served no purpose so you have deleted it.
● Given that several taxes and other deductions share common strategies of calculating deductions, you have delegated the common features, using the Strategy Pattern.
● You can use an Abstract Factory Pattern to set up the correct
deduction strategy for the tax, or deduction.
This is just one solution, there are many others, some more flexible, however you are trying to keep the scope limited.
● The Deduction, Tax, and DeductionStrategy are all abstract classes.
● We have not shown CountryTax to keep diagram clearer, but it still
Monthly Pay Run
Sequence Diagram in Design
Pay Run
Sequence Diagram for Pay Run in Design
Calculate Deduction
Sequence Diagarm In Design
● This is just one sequence of events for the Pay Run. ● This is part of the Pay Run Uses Case.
Tiered Rate Deduction
Sequence Diagram in Design
● This is just one sequence of event.
● This is part of the Pay Run Uses Case.
● Although not part of the current iterations, above is the sequence diagram for calculating tiered deductions.
● The class TieredRatenow performs the behaviour originally given to thePlanetTax class.