2D1385 Programutvecklingsteknik

Prutt06

2006-05-15

Take Home Exam

NOTES: (Please read these carefully!)

(i) Clearly mark at the top of each sheet you use: (a) your name (b) your e-mail address (in case I need to contact you) (c) the page number.

(ii) On the front page indicate how many pages are contained in your work in total.

(iii) Your work must be handed in to NADAs studentexpedition no later than Tuesday 16th May 2006 at 11.00 am. After this time it will be marked as late, and marks will be subtracted.

(iv) If you have any questions about the exam (for example, if you do not understand a question) you may call my mobile number 076 223 86 79. Please do not call before 9.00 am or after 9.00pm!

(v) You may use your kursbunt, and any course books. You are allowed to use the internet including search engines. However, any work which you download and use must be credited to its source. You are not allowed to collaborate with any other student or person. You are not allowed to discuss or share your work with anyone else before all manuscripts have been handed in. You are not allowed to copy anyone else's work. By handing in your manuscript you are declaring that you have abided by these rules. In the case that cheating is suspected, actions will be taken against any students involved.

(vii) Write clearly. No marks will be awarded for work that I cannot read. You can write your answers in swedish or english, unless otherwise stated in the question.

(viii) Answer all questions. Maximum marks are 40 points. A grade 3 will require at least 20 points or more, grade 4 will require at least 26 points or more, grade 5 will require at least 32 points or more.

(ix) Please download and fill out the course questionnaire..


Consider the following informal requirements document for a payroll program:

Some employees work by the hour. They are paid an hourly rate that is one of the fields in their employment record. They submit daily time cards that record the date and the number of hours worked. If they work more than 8 hours per day they are paid 1.5 times their normal rate for those extra hours. They are paid every Friday.

Some employees are paid a flat (non-hourly) salary. They are paid on the last working day of the month. Their monthly salary is one of the fields in their employment record.

Some of the salaried employees are also paid a commission based on their sales. They submit sales receipts that record the date and amount of the sale. Their commission rate is a field in their employee record. They are paid every second Friday.

Every employment record contains the name of the employee, together with any other relevant information.

Employees can select their method of payment. They may have their paychecks mailed to the postal address of their choice; they may have their paychecks held for pickup by the company cashier; or they can request that their paychecks be directly deposited into the bank account of their choice.

Some employees belong to the union. The union has a weekly dues rate. These dues must be deducted from union members pay. Also, the union may assess service charges against individual union members from time to time. These service charges are submitted by the union on a weekly basis and must be deducted from the appropriate employees next pay amount.

The payroll application will run once each working day and pay the appropriate employees on that day. Now an employee that should be paid on the current day may already have left the company. So for each employee to be paid on the current day, the system will be told up to what specified date (prior to the current date) the employees are to be paid. It will then generate payments for records from the last time the employee was paid up to the specified date.


Question 1 (Total 10 points)

Perform an object-oriented analysis of these requirements by identifying important nouns, verbs and relational phrases. Write these down in the form of a data dictionary that briefly defines the meaning of each noun, verb and relational phrase as you understand it from the requirements document.

You may write the definition of each component in Swedish but you must write each component (noun, verb, phrase) using the english text given above. You must sort your data dictionary alphabetically, and produce three separate lists for: (i) nouns (ii) verbs and (iii) relational phrases.

Question 2 (Total 10 points)

(i) (5 points) Draw a UML class diagram which accurately models the information contained in your data dictionary for Question 1. You should also include a recursive data structure to model lists of employees. Pay careful attention to any multiplicity constraints which you can identify.

(ii) (5 points) Draw a small UML object diagram that is a valid instance your UML class diagram. This diagram should show the example of a company with one single employee who has a monthly salary and is also paid on commission based on sales. The employee has made two sales and is a union member with two current service charges.

Question 3. (Total 10 points)

Your company, which is a large bureaucratic IT company with a high staff turnover, has been asked to implement the payroll program. The system is similar to others that have been previously built by your company, which has a good reputation in this applications domain. In fact, the customer seems to require that an existing Cobol mainframe implementation of the payroll software be re-written into Java and re-engineered to a new distibuted computing environment. Note that this Cobol implementation has very little documentation besides the commented code. It seems likely that your company will have to maintain this application for several years.

(i) (5 points) Choose one lifecycle model that would suit this project. Name the model and identify its strengths and weaknesses according to the project description above.

(ii) (5 points) Choose one appropriate architectural model and one appropriate pattern for the system and identify the likely contents of each architectural building block and each pattern component.

Question 4. (Total 10 points)

You decide to make employee information available on the companies intranet using the XML format.

(i) (4 points) Write a DTD that is suitable for defining an XML file that represents employee information based on your class diagram for Question 2.(i). You must: (i) avoid incorporating implementation details of the software into the XML file, and (ii) Use DTD/XML validation as much as possible to detect errors in XML files.

(ii) (4 points) Write a short XML file that models the object diagram developed in your answer to Question 2.(ii) and is a valid instance of your DTD.

(iii) (2 points) Does every object diagram which is a valid instance of your class diagram for Question 2.(i) lead to an XML file that is valid with respect to your DTD for Question 4.(i)? Explain why or why not.