Download presentation
Presentation is loading. Please wait.
1
Exam Fall 2013 Proposed Solution
Jan Pettersen Nytun Jan Pettersen Nytun - UiA
2
Jan Pettersen Nytun - UiA
1 enrolled * - enrolment 1 Student Enrolment Seminar - off - enrolment * - in - name : String - studentId : String - seminarName : String - maxStudents : int - numberOfStudents : int Propose Java code that correspond to the class diagram. - waiting * + addStudent(s:Student):void + getSeminarName():String - waitingOn * onWaitingList 1a – “package enrolment” may be omitted! Jan Pettersen Nytun - UiA
3
Jan Pettersen Nytun - UiA
1 enrolled * - enrolment 1 Student Enrolment Seminar - off - enrolment * - in - name : String - studentId : String - seminarName : String - maxStudents : int - numberOfStudents : int - waiting * + addStudent(s:Student):void + getSeminarName():String - waitingOn * onWaitingList 1b – Propose an object diagram that conforms to the class diagram above – it should contain information about 2 students that are enrolled at the same seminar. The seminar in question can take maximum 2 students (see attribute maxStudents) and a third student has been put on a waiting list (see association onWaitingList). Fill in slot values that you chose your selves (e.g., choose names for the students). Jan Pettersen Nytun - UiA
4
Jan Pettersen Nytun - UiA
1 enrolled * - enrolment 1 Student Enrolment Seminar - off - enrolment * - in - name : String - studentId : String - seminarName : String - maxStudents : int - numberOfStudents : int - waiting * + addStudent(s:Student):void + getSeminarName():String - waitingOn * onWaitingList off enrol- ment :Student e1:Enrolment :Seminar name = “Ola” studentId = “100” enrol- ment in seminarName = “RDF” maxStudents = 2 numberOfStudents = 2 in off :Student waitingOn e2:Enrolment :onWaitingList name = “Kari” studentId = “99” enrol- ment enrol- ment waiting :Student name = “Olga” studentId = “101” Jan Pettersen Nytun - UiA
5
Jan Pettersen Nytun - UiA
1c - Propose an XML document that in some way contains the information of the object diagram above. off enrol- ment :Student e1:Enrolment :Seminar name = “Ola” studentId = “100” enrol- ment in seminarName = “RDF” maxStudents = 2 numberOfStudents = 2 in off :Student waitingOn e2:Enrolment :onWaitingList name = “Kari” studentId = “99” enrol- ment enrol- ment waiting :Student name = “Olga” studentId = “101” <?xml version="1.0"?> <Student name = “Kari” studentId = “99” /> <Student name = “Ola” studentId = “100” /> <Student name = “Olga” studentId = “101” /> <Seminar seminarName= “RDF“ maxStudents= “2” numberOfStudents= “2” > <Enrolment studentId= “99” /> <Enrolment studentId= “100” /> <onWaitingList studentId= “101” /> </ Seminar> One may drop the numberOfStudents and just count entrolments inside the Seminar element. Jan Pettersen Nytun - UiA
6
Jan Pettersen Nytun - UiA
1d - Do the same as above (i.e., point c), but instead of an XML document, show the content in the form of tables as you find them in relational databases (show table names, column names and data). off enrol- ment :Student e1:Enrolment :Seminar name = “Ola” studentId = “100” enrol- ment in seminarName = “RDF” maxStudents = 2 numberOfStudents = 2 in off :Student waitingOn :onWaitingList e2:Enrolment name = “Kari” studentId = “99” enrol- ment enrol- ment waiting :Student name = “Olga” studentId = “101” Assuming seminar name is unique. Table: Student studentId name Table: Enrolment Table: Seminar 99 Kari studentId seminarName seminarName maxStudents numberOfStudents 100 Ola 99 RDF RDF 2 2 101 Olga 100 RDF Table: WaitingList studentId seminarName Jan Pettersen Nytun - UiA 101 RDF
7
Jan Pettersen Nytun - UiA
1 enrolled * - enrolment 1 Student Enrolment Seminar - off - enrolment * - in - name : String - studentId : String - seminarName : String - maxStudents : int - numberOfStudents : int * - waiting + addStudent(s:Student):void + getSeminarName():String - waitingOn * onWaitingList 1e) Write an OCL constraint that states that: The number of enrolled students (i.e., number of links from a Seminar object to Enrolment objects) is the same as the value of the numberOfStudents slot of the Seminar object. context Seminar inv: numberOfStudents = enrolment->size() 1f) Write an OCL constraint that states that a student cannot be enrolled for a seminar and at the same time be on the waiting list of the seminar. context Seminar inv: waiting->forAll( stud | self.enrolment.off->excludes(stud)) 1g) Write an OCL constraint that states that there can be no students on waiting list if there is less students enrolled than the value of maxStudents. context Seminar inv: (numberOfStudents < maxStudents) implies (waiting->size() = 0) Jan Pettersen Nytun - UiA
8
Jan Pettersen Nytun - UiA
1 enrolled Student * - enrolment 1 Enrolment Seminar - off - enrolment * - in - name : String - studentId : String - seminarName : String - maxStudents : int - numberOfStudents : int * - waitingOn - waiting * onWaitingList + addStudent(s:Student):void + getSeminarName():String + addSeminarFullListener( listener : Seminar FullListener):void -seminarToHandle 1 Some student will probably omit init() – since it is not part of the observer pattern. * «interface» SeminarFullListener + seminarFull() : void FullSeminarHandler + init(sem : seminar) : void + seminarFull() : void 1h) When a seminar gets full, operation seminarFull() in class FullSeminarHandler should be called. Use the observer design pattern with interface and make a class diagram for handling this. (The class diagram should extend the class diagram given above (i.e., the one containing Student, etc.) and contain class FullSeminarhandler.) When seminarFull() is called it will get hold of the seminar name (and in some way prompt a user, but you do not need to care about the prompting of the user). Add classes, interfaces, associations, etc., as you see necessary. You must also make a sequence diagram showing how this is meant to work. (The observer design pattern corresponds to the Listener-pattern found in Java.) Jan Pettersen Nytun - UiA
9
handler:FullSeminarHandler
1h) – Continues… handler:FullSeminarHandler sem:Seminar init(sem) addSeminarFullListener(self) addStudent(s) alt [numberOfStudents = maxStudents and waiting->size = 0] seminarFull() getSeminarName(self) [else] Jan Pettersen Nytun - UiA
10
Jan Pettersen Nytun - UiA
2 Nurses need to document the nursing process in regard to individual patients. The nursing process is about doing observations followed by appropriate nursing actions. We choose a nursing process model with the following phases: Diagnosis (what is the problem?) Planning (how to manage the problem) Implementation (putting plan into action) Evaluation (did the plan work?) Jan Pettersen Nytun - UiA
11
Jan Pettersen Nytun - UiA
2 continues… Descriptions of the different stages all fit in a patient journal. We consider the process to be sequential and iterative; in practise this means that a patient journal will be structured as follows: First iteration: Diagnosis (first diagnosis) Planning (first planning) Implementation (first implementation) Evaluation (first evaluation) Second iteration: Diagnosis (second diagnosis) Planning (second planning) Implementation (second implementation) Evaluation (second evaluation) Third iteration: Diagnosis (third diagnosis) Etc. Jan Pettersen Nytun - UiA
12
Jan Pettersen Nytun - UiA
2 continues… Not all iterations contain all the four phases (e.g., the evaluation phase may be left out). For now we consider the description of one nursing phase to simply be a short text; information about which nurse inserted such a description should be recorded. Name and social security number of the nurses involved are to be recorded. The same information about the patient should also be recorded. Additionally information about what institution (e.g., hospital, nursing home) the description was inserted at should be recorded. Name and address of an institution should be recorded. A patient has one patient journal that is accessible at all institutions. Jan Pettersen Nytun - UiA
13
Jan Pettersen Nytun - UiA
Person Propose a class diagram capturing the information above. name : String SSN : String insertedBy Nurse Patient 1 concerns 1 1 * 1 Iteration PatientJournal iterationNum : Integer 1 0..4 * insertedAt Phase Institution * 1 description : String name : String address : String Diagnosis Plan Implementation Evaluation Jan Pettersen Nytun - UiA
14
b) Propose an object diagram that conforms to your class diagram above – the object diagram should exemplify two iterations of the process for one patient; the iterations contain all the phases (diagnosis, planning, etc.). You select yourselves the text describing the phases. The phases have been entered by two different nurses working at two different institutions (your object diagram should also show this).
15
Patient name = “Ola” SSN = 1 concerns : PatientJournal : Iteration
: Institution : Iteration iterationNum = 110 name = “Inst.1” address = “addr. 1” iterationNum = 111 : Diagnosis : Nurse : Diagnosis description= “diag. 1” description= “diag. 2” name = ”nurse 1” SSN = 2 : Plan : Plan description= “plan 1” : Nurse description= “plan 2” : Implementation name = ”nurse 2” SSN = 3 : Implementation description= “impl. 1” description= “impl. 2” : Evaluation : Institution : Evaluation description= “eval. 1” description= “eval. 2” name = “Inst.2” address = “addr. 2”
16
Jan Pettersen Nytun - UiA
A nursing home is a place of residence for people who require continual nursing care and have significant deficiencies with activities of daily living. When a patient arrives at a nursing home a nurse is assigned as the patient main contact. The main contact determines a diagnosis together with the patient; the diagnosis is described in the patient journal. The main contact then formulates a treatment plan which is also described in the patient journal and approved by the nursing head (the nurse in charge of the nursing home). If the nursing head do not approve the diagnosis or the plan, then the main contact must redo this and once more get the approval of the nursing head (this will be repeated until it gets approved). During daily care the plan is implemented and evaluated by the main contact and the patient. Once a week a new diagnosis and plan is made (this marks the beginning of a new iteration) by the main contact, and once again the nursing head must give approval and the processes continues as just described. Jan Pettersen Nytun - UiA
17
c) Given the texts above, make a use case diagram and use case texts.
The students may add more or less details! patient arrives nursing head patient main contact Use case text: Patient arrives at a nursing home. Nursing head assigns the patients main contact. Jan Pettersen Nytun - UiA
18
Jan Pettersen Nytun - UiA
make diagnosis patient main contact Use case text: Main contact together with patient determines a diagnosis Main contact describes/updates the diagnosis in the patient journal. Jan Pettersen Nytun - UiA
19
Main contact makes treatment plan.
make treatment plan and get approval of diagnosis and plan main contact nursing head Use case text: Main contact makes treatment plan. Main contact presents diagnosis and treatment plan to nursing head. If approved, main contact describes the treatment plan in the patient journal. If nursing head do not approve treatment plan but accept diagnosis then this current use case must be repeated. Otherwise, if nursing head do not approve diagnosis then use cases “make diagnosis” and “make treatment plan and get approval of diagnosis and plan” must be repeated. Jan Pettersen Nytun - UiA
20
Jan Pettersen Nytun - UiA
daily care “other” patient main contact Use case text: Main contact, together with others, nurse the patient and implement the treatment plan. Main contact continuously update the implementation and evaluation part of the patient journal. When one week has past the main contact initiate use case “make diagnosis”, etc. Jan Pettersen Nytun - UiA
21
Nursing head assigns the patients main contact.
d) Given the text above, make a high level activity diagram describing the activities being described. Patient Arrives. Nursing head assigns the patients main contact.
22
One Iteration Patient Main Contact Nursing Head Make diagnosis.
Diagnosis described/updated in patient journal. Make treatment plan. Investigate treatment plan and diagnosis. Presents diagnosis and treatment plan to nursing head. [diagnosis not approved] [else] [plan not approved] Describe the treatment plan in the patient journal. [plan approved] Implement treatment plan and continuously update the implementation and evaluation part of the patient journal.
23
Jan Pettersen Nytun - UiA
e) To make analysis more effective the description of the different phases should be more structured (i.e., a phase should not be described only with a text). The kind of analysis in question could be: Find if a medicine is working or not in regard to some sickness. Extend or change your model from above (class diagram from point a) so that it becomes explicit that a medicine is used as part of a plan to treat a sickness being a part of the diagnosis; and further on, that the actual medication is documented as part of the implementation. Also, the effect of the medication should be evaluated in regard to the sickness it is meant to treat – such an evaluation should be one of the following statements: “Medicine works well”, “Medicine does not work”, “Medicine has negative effect”. Assume the medication doses are given in milligram. Add classes, associations and make your own assumptions as you see necessary. Jan Pettersen Nytun - UiA
24
Some of the original classes are not shown since they are not important in regard to this task. The given solution is not very advanced… Some of the multiplicities may be discussed… * 1 Iteration PatientJournal iterationNum : Integer 1 0..4 Phase description : String Diagnosis Planning Implementation Evaluation 1 1 1 * * Sickness ActualMedication 1 description : String doses : Integer description : String * * * Medication Evaluation 1 medicinName: String medicationProcedure : String dosesPrescribed : Integer medicinName: String medicationProcedure : String dosesPrescribed : Integer * * * *
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.