CS计算机代考程序代写 Java 300144 Object Oriented Analysis 300888 Object Oriented Analysis (Advanced)

300144 Object Oriented Analysis 300888 Object Oriented Analysis (Advanced)
Tutorial 7 – Sequence, Interaction Overview & State Machine Diagrams (Week 10)
Student Name: ______________________________________ Student ID: ______________________________________ Tutorial Class: ______________________________________
Instructions to students –
 Attempt all questions
 This Tutorial will contribute to your final assessment mark
 The Tutor will check your solutions when you are finished
 BICT (Advanced) students need to complete optional questions.

Project Work 7 (marked):
1. Identify sequences within your project work. They can be either the documentation of a use case or an activity diagram. Draw a sequence diagram corresponding to that sequence. Try to draw ONE sequence diagram for each of the main use cases within your package.
2. Now consider a sequence of events that cuts across more than one use case and/or activity diagrams and draw another sequence diagram from that sequence.
3. Each sequence diagram may typically contain four to six objects in it (just for reference, not necessary to be exactly in this range)
4. Notice how the drawing of sequence diagrams could update the corresponding class diagrams. The updates are in terms of classes’ attributes and operations, as well as discovery of new classes. If you discover new classes as a result of drawing the sequence diagrams, update the class diagrams.
5. Draw at least ONE interaction overview diagram per package. This diagram, based on your package, could include references of use cases and sequence diagrams of other packages. Ensure you have shown scenarios containing “if- then-else” with use cases and/or sequence diagrams of your system (decision points) and including parallel processes (if any).
6. Draw TWO state machine diagrams with two important, dynamic and complex objects of each package. Investigate how their states will change based on the messages they receive throughout their lifecycle. Apply the transitions to these states, add guard conditions and identify nested states where applicable.
7. Ensure you have added enough notes on all your diagrams drawn in your CASE tool to clarify your analysis work.
Note: As this week project work is a guideline toward to the completion of the project, so for this tutorial, you are required to produce one “good” diagram for each type, i.e. one sequence diagram, one interaction overview diagram and one state machine diagram. The available UML tools might not have the identical type of the diagrams, thus you need to check all available UML types to find the ingredients for certain diagrams.
General guidance:
Visio doesn’t have interaction overview diagram. However, all its ingredients are available from UML Activity and the ingredient “Reference” is available from UML Sequence (change Opt or Loop to Reference or Ref in short).

For sequence diagrams, some examples in textbook and/or lecture notes can be used almost directly such as payment, update a calendar. Some others are very similar like patient registration (organisation customer registration), booking consultation (booking a delivery). Just follow use case documents (and activity diagrams) to draw the sequence diagrams.
For interaction overview diagram, the Accounting Diagram should be very similar to the one of HMS, and Delivery Booking and Delivery Dispatch can take “consultation details” of HMS for reference, to draw the diagram with a series of references to use cases like CheckCalendar, CheckResource, Dispatch, ContactPartner and some processes can go in parallel. Decision points can be “any banned items?”, “having the resources?”, “business partners can help?” etc.
For State Machine, students can check the following object states:
deliveryJob: requestedbookeddispatchedchecked (could be rejected and end)  delivered (could then be passed to partner)  received (could be lost, damaged etc.) (the billed state could be inserted at booking, checking or receiving point)
As the delivered items, accompanied with the above state transitions, could be passed from sender to GWEC, from GWEC to business partner, from business partner to receiver, we could add nested states to describe these different stages of the delivery.
Due to limitation of available resources, GWEC could only take a certain number of emergent (the same day) special delivery jobs per day. So, the example similar the one of textbook could be taken for reference:
Open State nested with inner states Available and FullyBooked. Guide condition “Cancelled”: FullyBookedAvailable.
Close State nested with inner states: Delivered and Billed.
The state machine diagram for “Bill payment” is the same as the example of textbook.
Tutorial Exercises (Optional):
Draw the state machine based on the following Java program (you may run the program first):
import java.io.*; // program uses for I/O
class Student {
protected long studentID;
protected static long nextNum = 20000000;
protected String name, course, status;
protected boolean enrolled;
protected boolean atRisk;
protected boolean suspended;

protected boolean completeCourse;
protected boolean completeMajor;
protected boolean removed;
Student() {
studentID = ++nextNum;
enrolled = true;
atRisk = false;
suspended = false;
completeCourse = false;
completeMajor = false;
}
public void displayDetails() {
System.out.println(“\nstudentID: ”
+ studentID + “, Name: ”
+ name + “, Course: ” + course
+ “\nStatus: “+ status);
}
public void setName (String aName) {
name=aName;
}
public void setStatus(String aStatus){
status = aStatus;
} }
class StudentBICT extends Student {
StudentBICT() {
course=”BICT”;
} }
class StudentBIS extends Student {
StudentBIS() {
course=”BIS”;
} }
class StudentBCS extends Student {
StudentBCS() {
course=”BCS”;

} }
public class CourseStudy {
public static void main(String[] args) throws
IOException
{
int year=1;
final int maxYear=5;
String inputStr;
char yesOrNo;
BufferedReader input = new BufferedReader(new
InputStreamReader(System.in));
// create InputStreamReader to obtain input
from command window
Student oneStudent = new StudentBICT();
oneStudent.setName(“Mary A. Smith”);
while (year++ <= maxYear) { or N: " ); System.out.print( "Stude complete course? Y inputStr = input.readLine(); yesOrNo = inputStr.charAt(0); if (Character.toUpperCase(yesOrNo) =='Y') { oneStudent.completeCourse = true; System.out.print( "Stude complete major as well? Y or N: " ); =='Y') { inputStr = input.readLine(); yesOrNo = inputStr.charAt(0); if (Character.toUpperCase(yesOrNo) oneStudent.completeMajor = true; } N: " ); else { System.out.print( "Stude at risk? Y or inputStr = input.readLine(); break; } else if (year>maxYear) {
complete course in 5 years
//need
oneStudent.removed = true;
break; }

==’Y’) {
at risk
time at risk
yesOrNo = inputStr.charAt(0);
if (Character.toUpperCase(yesOrNo)
if (oneStudent.atRisk) { //already
oneStudent.suspended = true;
break; }
improved, clear atRisk
}
}
} else
else
//first
oneStudent.atRisk = true;
oneStudent.atRisk = false; //
if (oneStudent.completeCourse &&
oneStudent.completeMajor)
oneStudent.setStatus(“Graduate with Degree
and Major”);
else if (oneStudent.completeCourse)
Degree”);
oneStudent.setStatus(“Graduate with
else if (oneStudent.suspended)
oneStudent.setStatus(“Suspended”);
else
oneStudent.setStatus(“Removed”);
oneStudent.displayDetails();
}
}
Hint: The state of one student object is as “enrolled” at the beginning and has four different statuses at the end; “graduate with degree and major”, “graduate with degree”, “suspended” and “removed”.
Guidance: If unable to complete the course in 5 years, the student will be removed; if at risk in two years in a row, the student will be suspended, if not at risk in a year, the atRisk status in the previous year (if true) will be cleared (reset to false); when graduate, the student may have both degree and major, or only the degree.