Employee does not completely follow the usual pattern for initializing objects. It has an instance method name: in protocol initialize-release, but it has no class methods in protocol instance creation. Create a method name: whose implementation will be
^self new name: aString
You should then find every place that uses Employee new name: aName and replace it with Employee name: aName. One way to find them is to go to the method name: and to select senders from the menu in the protocol pane. What is wrong with this approach?
Another approach is to select class refs from the menu in the class pane. This shows the one place you need to change. Change it. Put a self halt in the class method name: Run PayrollSystem test and make sure it is reaching the halt you inserted. When it does, take out the halt.
Print a printOn: method for Employee that prints out the name of the employee.
Write a printOn: method for transactions so that they print out as "Paycheck for Ralph Johnson on January 15, 1996", or "Timecard for Ralph Johnson on April 3, 1996". If you are clever, you can probably do this with one method in EmployeeTransaction, since you can ask the transaction for the name of its class. "transaction class name"
Notice the difference this makes when you inspect an Employee and the PayrollSystem.
Write a script that simulates the following. Write it in a Workspace. Keep adding to it little by little. Read the code to figure out the exact syntax for anything you don't know how to do. Ask, if you can't find the right place in the code. When you are done, show me the workspace.
John Doe was hired May 1, 1995. His initial salary was $15 an hour. He turned in his time-card on May 5 and had worked 40 hours. He worked 40 hours the week of May 12, too. He received a pay-check on May 15. What was his take-home pay?
Taxes are likely not being computed correctly. What are some pieces of information that are not being collected that seem suspicious?
The payroll system doesn't handle vacation. Class Employee has a variable defined for it, and each time-card collects the amount of vacation time that was taken that week, but the code for processing time-cards does nothing about vacation.
Change the payroll system to record the amount of vacation time that has been taken and the vacation time that has accrued. Assume that for every 50 hours of non-overtime that an employee works, they get 2 hours of vacation time. You should not need to add any more instance variables to any classes. You could do this by adding to accrued vacation
(hours worked / 25) - hours of vacation taken.
To find where the work gets done, try single-stepping through the posting of a time-card. Place a halt to start the debugger, and then single-step from there. You'll have to figure out how to get the hours of vacation taken and the hours worked. They are stored in the time-card.