PPT2
PPT2
1
@ McGraw-Hill Education
2
@ McGraw-Hill Education
3
@ McGraw-Hill Education
4
@ McGraw-Hill Education
a b c
6
@ McGraw-Hill Education
a T b
F
7
@ McGraw-Hill Education
Alarm
On
9
@ McGraw-Hill Education
10
@ McGraw-Hill Education
Y
is not fastened within 10 seconds of ignition ON, the Seat Belt ON?
N
The Alarm is turned off when the alarm time (5 Set Timer for 5 Seconds
Start Alarm
happens first. NO
Y
YES
NO Seat Belt ON?
N
Timer Expired? YES
Y
Stop Alarm
End
11
@ McGraw-Hill Education
#define ON 1
#define OFF 0
#define YES 1
#define NO 0
void seat_belt_warn()
{
wait_10sec();
if (check_ignition_key()==ON)
{
if (check_seat_belt()==OFF)
{
set_timer(5);
start_alarm();
while ((check_seat_belt()==OFF )&&(check_ignition_key()==OFF )&& (timer_expire()==NO));
stop_alarm();
}
}
}
12
@ McGraw-Hill Education
13
@ McGraw-Hill Education
(b)
15
@ McGraw-Hill Education
Structural things: Represents mostly the static parts of a UML model. They are also known
as ‘classifiers’. Class, interface, use case, use case realization (collaboration), active class,
component and node are the structural things in UML.
Behavioral things: Represents mostly the dynamic parts of a UML model. Interaction, state
machine and activity are the behavioral things in UML.
Grouping things: Are the organizational parts of a UML model. Package and sub-system are
the grouping things in UML.
Annotational things: Are the explanatory parts of a UML model. Note is the Annotational
thing in UML.
16
@ McGraw-Hill Education
Alarm – Timer Class interaction for the Seat belt Warning System
19
@ McGraw-Hill Education
20
@ McGraw-Hill Education
21
@ McGraw-Hill Education
Diagram Description
Gives a pictorial representation of a set of objects and their
Object Diagram relationships. It represents the structural organization between
objects.
Gives a pictorial representation of the different classes in a
Class Diagram UML model, their interfaces, the collaborations, interactions
and relationship between the classes etc. It captures the static
design of the system.
It is a pictorial representation of the implementation view of a
Component Diagram system. It comprises of components (Physical packaging of
classes and interfaces), relationships and associations among
the components.
It is a representation of the organization of packages and their
Package Diagram elements. Package diagrams are mostly used for organizing use
case diagrams and class diagrams.
It is a pictorial representation of the configuration of run time
Deployment Diagram processing nodes and the components associated with them.
22
@ McGraw-Hill Education
Diagram Description
Use cases diagrams are used for capturing system functionality as seen
by users. It is very useful in system requirements capturing. Use case
Use case Diagram diagram comprised of use cases, actors (users) and the relationship
between them. In use case diagram, an actor is one (or something) who
(or which) interacts with the system and use case is the sequence of
interaction between the actor and system.
Sequence diagram is a type of interaction diagram representing object
Sequence Diagram interactions with respect to time. It emphasizes on the time ordering of
messages. Best suited for the interaction modeling of real-time systems.
Collaboration or Communication diagram is a type of interaction
Collaboration (Communication) diagram representing the object interaction and ‘how they are linked
Diagram together’. It gives emphasize to the structural organization of objects
that send and receive messages. In short, it represents the collaboration
of objects using messages.
A diagram showing the states, transitions, events and activities similar
State Chart Diagram to a State Machine representation. Best suited for modeling reactive
systems.
It is a special type of state chart diagram showing activity to activity
Activity Diagram transition in place of state transition. It emphasizes on the flow control
23
among objects.
@ McGraw-Hill Education
Actors
Enable or Disable
Seat Belt
Alarm
Ignition Key
3 OFF
5 Trigger
1 Trigger
2 Timeout
6 Timeout
4 ON
Sequence diagram for one possible sequence for the Seat Belt
Warning System 24
@ McGraw-Hill Education
25