Académique Documents
Professionnel Documents
Culture Documents
OOAD LAB
INDEX
1. Unified modeling language 2. Use case Introduction 3. Use case diagram a. Use case of ATM machine b. Use case of Library management c. Use case of Railway Reservation System 4. Class introduction 5. Class diagram a. Class diagram of collage management system b. Class diagram of Hospital Management system c. Class diagram of Library management system 6. Interactive diagram Introduction 7. Interactive diagram a. Interactive diagram for ATM machine b. Interactive diagram for Library Management system c. Interactive diagram for Railway Reservation system 8. Collaboration introduction 9. Collaboration diagram a. Collaboration diagram for ATM machine b. Collaboration diagram for Library machine c. Collaboration diagram for Railway Reservation machine 10. State machine diagram 11. State chart diagram for CD player 12. Activity diagram introduction 13. Activity diagram a. Activity diagram of ATM without swinlanes b. Activity diagram of ATM with swinlanes 14. Component diagram introduction 15. Component diagrams a. Component diagram for ATM System b. Component diagram for Hospital Management System 16. Deployment diagram 17. Deployment diagram for ATM system 18. Forward engineering 19. Reverse engineering 20. Case study a. Bank ATM System b. Cellular phone Network c. Student course registration system d. Hospital Management System e. Library Information system f. Ticket vending system g. Trading system 2 8 10 11 12 13 16 17 18 19 22 23 24 25 26 27 28 30 32 33 35 36 37 41 42 43 44 45 54 61 69 79 88 97 107 115
Page 1
Roll No:_____________________
OOAD LAB
There are 2 types of diagrams. They are, 1. Static Diagrams a) Use case diagrams b) Class diagrams c) Object diagrams d) Component diagrams e) Deployment diagrams 2. Dynamic diagrams a) Interaction diagrams i) Sequence diagrams ii) Collaboration diagrams b) State machine diagrams i) State chart diagrams ii) Activity diagrams Applications of UML: UML is intended primarily for software intensive systems. It has been used effectively for such domains as 1. 2. 3. 4. 5. Enterprise Information Systems Banking and Financial Services Telecommunications Transportation Defense and Aerospace
Page 2
Roll No:_____________________
OOAD LAB
6. 7. 8. 9.
Basic building blocks of UML: The building blocks of UML can be categorized as 1. Things 2. Relationships and 3. Diagrams Things:Things are the most important building blocks of UML. Things can be a) b) c) d) Structural Behavioral Grouping Annotational
a) Structural Things: They define the static part of the model. They represent physical and conceptual elements. Following are the structural things 1. Class: - It describes a set of objects that share the same attribute operations, relationships and semantics.
Class name Attributes Operations
Page 3
Roll No:_____________________
OOAD LAB
4. Use case: - They a e used to identify diffe ent use case com onents of a pa ticula softwa e project. It is used to model the operation.
5. Componen : - It is a physical and replaceable part that confirms to and provides realization of set of interfaces.
6. Node: - A physical resource that exists in runtime and represent a computational resource.
7. Actor: - The out side entity that communicates with a system. Typically a person playing a role on an external device.
b) Behavioral Things: They consist of dynamic parts of the UML model. The following are behavioral things
K ti I stitut h i P 4
3. Co abora ion: - It de
Roll No:_____________________
OOAD LAB
1. Interaction: - It is defined as a behavior that consists of a group of message exchanged among elements to accomplish a specific tas .
message
2. State machine: - It is useful when the states of an object in its life cycle. It defines the se uence of states and object goes through in response to events.
c) Grouping Things: They can be defined as a mechanism to group elements of UML model together. There is only one grouping thing available i.e., Package. Package is used for gathering structural and behavioral things.
d) Annotational Things: - They can be defined as a mechanism to capture remarks, description and comments of UML model elements. There is only one annotational thing available i.e., Note. Note is used to render comments, constraints and so on of a UML element.
ti
I stitut
Roll No:_____________________
OOAD LAB
Relationships: The relationship is another most important building block of UML. They show how elements are associated with each other and their association describes the functionality of application. There are 5 types of relationships. They are, 1. Dependency: It is a relationship between two things in which change in one element also affects another.
2. Generalization: It can be defined as a relationship which connects a specialized element with a generalized element. It basically describes inheritance relationship in the object. It is a is_a hierarchy.
3. Realization: It can be defined as a relationship in which two elements are connected. One element describes some responsibility which is not implemented and the other one implement then. This relationship e ists in case of interfaces.
4. Association: It is a set of links that connects elements of an UML model. Two types of associations a) Unidirectional b) Bidirectional c) 5. Aggregation: It is a has_a relationship. It is of two types as a) Simple aggregation b) Composition aggregation
Page 6
Roll No:_____________________
OOAD LAB
UML Diagrams: 1. Class diagram 2. Use case diagram 3. Interaction diagram i) Sequence diagram ii) Collaboration diagram 4. State machine diagram i) State chart diagram ii) Activity diagram 5. Component diagram 6. Deployment diagram
Page 7
Roll No:_____________________
OOAD LAB
Customer (actor)
Actors are discovered by e amining, y y y y Who directly uses the system Who is responsible for maintaining the system? External hardware used by the system. Other systems that need to interact with the system.
Page 8
Roll No:_____________________
OOAD LAB
Use case: A use case can be described as a specific way of using the system from users (actors) perspective. Use case can be characterized asy A pattern of behavior the system exhibits. y A sequence of related transactions performed by an actor and the system. y Delivering something of value to the actor.
Transfer Funds
Use cases provide a means to, y Capture system requirements. y Communicate with end users and domain experts. y Test the system.
Page 9
Roll No:_____________________
OOAD LAB
change password
Withdraw money
Database server
Page 10
Roll No:_____________________
OOAD LAB
search books
Renew books
Student
Return books
Page 11
Roll No:_____________________
OOAD LAB
Enquiry
Checking
Reservation
Berth availability
fares
Issue ticket
Confirmation of ticket
Cancellation of ticket
Page 12
Roll No:_____________________
OOAD LAB
4.CLASS DIAGRAMS
The class diagram contains icons representing classes, interfaces and their relationships. Class:A class is a set of objects that share a common structure and common behavior (the same attributes, operations and semantics). A class is a abstraction of real-world items. When these items exist in the real-world, they are instances of the class and are referred to as objects. A class icon is a 3-part box.
Class name Attributes Operations
1. Generalize relationship for classes: It shows that sub classes share the structure or behavior defined in one or more super classes. Use a generalize relationship to show is_a relationship.
Super class
Sub class 1
Sub class2
2. Dependency Relationship: The dependency is a relationship between two model elements in which change in one element will affect the other model element. Typically on class diagrams, a dependency relationship indicates that the operations of the client invoke operation of the supplier.
Page 13
Roll No:_____________________
OOAD LAB
Ca d nal ty Ado n ent:- Ca d nal ty spec f es how any nstances of one class ay be assoc ated w th s ngle nstance of othe class. When you apply a cardinality adornment to a class, you are indicating number of instances allowed for that class. A relationship, you are indicating number of links allowed between one instance of a class and the instances of another class. Val d Values: Value Description 0..0 zero 0..1 zero or one 0..n zero or more 1..1 one 1..n one or more n unlimited number Inte face:-An interface specifies the externally visible operations of a class and/or component, and has no implementation of its own. An interface specifies only a limited part of behavior o f class or a component. 3. Association relationship: An association provides a pathway of communications. The communication can be between use cases, actors, classes or interfaces. If two classes are usually considered independently, the relationship is an association.
Unidirectional Bi directional
Customer
Transfer funds
4. Aggregate relationship: Use the aggregate relationship to show a whole or part relationship between two classes.
Kakatiya Institute of Technology and Science Page 1
Roll No:_____________________
OOAD LAB
Unidirectional aggregation
Bidirectional aggregation
ti
I stitut
Roll No:_____________________
OOAD LAB
College name : string location : string 1 Add student() remove student() add dep() rem dept() add staff() rem staff() 1 * T&P section stud_id : int stud_name : string Branch : string company name : string Recruitment() * 1 * 1 *
Non teaching staff name : string Qualification : string * * 1 Department 1 * 1 Library Book id : int 1 Issue() renewal() * Collect fine() collect books() 1 * * student id : int name : string Branch : string Enrollment() Attend classes() Attend Exams() * * * Lecturer Subject id : int name : string name : string Designation : string Dept id : int Teaching() 1 Dept num : int Dept name : string Location : string Add subject() Remove subject() 1..*
Page 16
Roll No:_____________________
OOAD LAB
Medical store medicine name : string medicine cost : int supply medicines() 1
1 1 Department Dept num : int Dept name : string Location : string <<>maintain doctor records() 1
Doctors * Name : string Specialization : string perf general checkups() * * pres medicine() pres tests() perf sugery()
* Treatment disease type : string treatment : string Patients Name : string consulting doc name : string * * Bill payment() * *
Surgeons
Physicians
Interns
In patient
Out patient
Nurses
Lab tehnicians
Page 17
Roll No:_____________________
OOAD LAB
Library Name : string Location : string Issue cards() maintain book details()1 1 Library admin Id : int Name : string Manages library() 1 * * Librarian Id : int Name : string Issue books() 1 renewal() collect fine() collect books() * Operation Book id : int issue() renewal() return() fine() * User id : int Name : string * 1 Take books() pay fine() return books() 1 1 1 * Books Book id : int Title : string Author : string
student
Faculty
Page 18
Roll No:_____________________
OOAD LAB
6.INTERACTION DIAGRAMS
An interaction is an important sequence of interactions between objects. There are two types of interaction diagrams, a) Sequence Diagrams . b) Collaboration diagrams. 1. Sequence D ag a s: A sequence diagram is a graphical view of a scenario that shows object interaction in a time based sequence, what happens first, what happens next. Sequence diagrams establish the roles of objects and help provide essential information to determine class responsibilities and interfaces. A sequence diagram has two dimensions: vertical placement represents time and horizontal placement represents different objects. L nk: Objects interact through their links to other objects. A link is an instance of an association, analogous to an object being instance of a class. A link should exist between two objects, including class utilities, only if there is a relationship between their corresponding classes.
Message cons: A message icon represents the communication between objects indicating that an action will follow. The message icon is a horizontal, solid arrow connecting two lifelines together.
Page 19
Roll No:_____________________
OOAD LAB
Li eline: Each object appearing on the se uence diagram contains a dashed vertical line, called lifeline, which represents the location of an object at a particular point in time. The lifeline also serves as a place for messages to start and stop and a place for the focus of control to reside.
#
Message or Event: a message is a communication carried between two objects that trigger an event. A message is represented in collaboration and se uence diagrams by a message icon which usually indicates its synchronization. Synchronization types that are supported. 1. 2. 3. 4. 5. 6. 7. Simple Synchronous Balking Time out Asynchronous Procedure call Return
#
ti
"
Lifeline
I stitut
Roll No:_____________________
OOAD LAB
Message to self: It is a tool that sends a message from one object back to the same object. The sender of the message is same as the receiver.
Tools: 1. Object
4. Return message
5. Destruction marker
Page 21
Roll No:_____________________
OOAD LAB
ATM
Database server
2: Check card 3: Invalid:Insert card properly 4: Valid:Display enter pin number 5: Enter pin number 6: Check pin number 7: Valid/Invalid 8: Invalid:Re enter pin number 9: Valid:displays Menu 10: Select withdraw option from menu 11: Enter with draw amount 12: Check for available balance 13: Available/Not 14: Not: Displays menu balance not available
15: Available:Transaction performed 16: Do u want to continue transactions? 17: Close transaction
Page 22
Roll No:_____________________
OOAD LAB
Library
Librarian
Database
2: Available/not
3: Available:Takes books 4: Not:Leaves Library 5: Gives ID card for issue of book 6: Checks for validation
7: Valid/Not
11: Renewal of books 12: Checks fine amount 13: Pays fine
Page 23
Roll No:_____________________
OOAD LAB
Reservation ounter
$
database
3: Available:Yes/No
4: No:End enquiry
9: 10:
&%
2:
'
atabase
Page 2
Roll No:_____________________
OOAD LAB
8.Collaboration diagrams:- A collaboration diagram is an interaction diagram that shows the order of messages that implement an operation or a transaction. Collaboration diagrams show objects, their links, and their messages. They can also contain simple class instances and class utility instances. Each collaboration diagram provides a view of the interactions or structural relationships that occur between objects and object-like entities in the current model. Collaboration diagrams contain icon s representing objects. The Create Collaboration Diagram Command creates a collaboration diagram from information contained in the sequence diagram. The Create Sequence Diagram Command creates a sequence diagram from information contained in the interaction's collaboration diagram. The Goto Sequence Diagram and Goto Collaboration Diagram commands traverse between an interaction's two representations.
Page 2
Roll No:_____________________
OOAD LAB
15: 14: N : 9: V 8: 4: V 3: :
: : :R : M 13: 7: V /N / 12:
6:
Page 26
Roll No:_____________________
OOAD LAB
q L L L
G P P B B
Page 27
Roll No:_____________________
OOAD LAB
1: Enquiry about train 6: Pay money for ticket 9: Confirms Reservation 10: Cancellation of ticket Passenger 4: No:End enquiry 5: yes:Tells the details of train 7: Issues ticket 2: Check for availability 8: Updates Database 11: Updates database Reservation counter
3: Available:Yes/No
database
Page 28
Roll No:_____________________
OOAD LAB
10.STATE-MACHINE DIAGRAMS There are two types of state-machine diagrams: 1. State chart diagram 2. Activity diagram 1. State cha t d ag a : state chart diagrams model the dynamic behavior of individual classes or any other kind of object. They show the sequence of states that an object goes through the events that cause a transition from one state to another and the actions that result from a state change. A state chart diagram is typically used to model the discrete stages of an objects lifetime. A state chart diagram typically contains one start state and multi ple end states. 1. State :- A state represents a condition or situation during the life of an object during which it satisfies some condition or waits for an event. Each state represents a cumulative history of its behavior. States can be shared between state machines. Transitions cannot be shared.
2 0 1 0
Naming: The name of the state must be unique to its enclosing class , within the state. Actions: Actions on states can occur at one of four times y On entry y On exit y Do y On event 2. Sta t state:- A start state (also called an initial state ) explicitly shows the beginning of the execution of the state machine on the state chart diagram or beginning of the workflow on an activity diagram. Normally, one outgoing transition can be placed from the start state.
Kakatiya Institute of Technology and Science
3
Page 29
Roll No:_____________________
OOAD LAB
However, multiple transitions may be placed on start stat e, if at least one of them is labeled with a condition. No incoming transitions are allowed. The start state icon is a small, filled circle that may contain the name (Begin process).
Begin process
3. End state:- An end state represents a final or terminal state on an activity or state chart diagram.. Transitions can only occur into an end state. The end state icon is a filled circle inside a slightly larger unfilled circle that may contain the name (End process).
End process
4. State t ans t on:- A state transition indicates that an action in the source state will perform certain specified actions and enter the destination state when a specified event occurs or when certain conditions are satisfied. A state transition is a relation ship between two states, two activities or between an activity or a state. The icon for a state transition is a line with an arrow head pointing toward the destination state or activity.
5 5 4
We can show one or more state transitions from a state as long as each transition is unique. Transitions originating from a state cannot have the same event, unless there are conditions on the event. Naming: We should label each state transition with the name of at least one event that causes the state transition. We do not have to use unique labels for the state transitions because the same event can cause a transition to many different states or activities.
Page 30
Roll No:_____________________
OOAD LAB
Tools: 1. State
2. Activity
3. Start state 4. End state 5. State transition 6. Transition to self 7. orizontal synchronization
8. Vertical synchronization
9. Decision
10. Swimlanes
ti
I stitut
Roll No:_____________________
OOAD LAB
power on
open
pl y
9
ewind
Forward
S op
7
9 7
Selec song
8 7
Inser
i sk
Pause
Resume song
Page 32
Roll No:_____________________
B CB A
OOAD LAB
12.Activity i r m:- An activity diagram is a special case of state diagram. An activity diagram is like a flow chart showing the flow a control from one activity to another. An activity diagram is used to model dynamic aspect of the system. Activity diagram contains: 1. Activity states and action states 2. Transition 3. Object Action state:- These are atomic, executable computation which represents the execution of an action.
Activity state:- They can be decomposed. That is, their activity is represented by other activity diagrams.
Branching:- In branching, we have one incoming transition and two or more outgoing transitions.
Decision
Forking and Joining:For ing:- It is a process of splitting a single flow of control into multiple flow of controls. Generally a fork has a single incoming flow of control but multi outgoing flow of control.
D
Joining:- It is exactly opposite of forking. It generally has multiple incoming flows of control but single outgoing flow of control.
Swim-lanes:- They represent the columns in the activity diagram to group the related activities. These are represented in the form of partitioned region.
K ti I stitut h i P
Roll No:_____________________
OOAD LAB
Swim-lanes are helpful when modeling a business work flow because they can represent organizational units or role with in a business model. Swim-lanes are very similar to an object because they provide a way to tell who is performing a certain role.
Page 3
Roll No:_____________________
OOAD LAB
QH I eaV d P G G
EaT I FE Hc P P VHa H b G
EaT I FE Hc P P QE
EaT I FE H P P E I X ` P GYG
QH I H FE P G
QT f YP
H WVUE G ET H ER S G
a g
QT eE YP
F G
Page 3
Roll No:_____________________
OOAD LAB
Customer
Bank system
I t
tqs r p xp
ip
h v rs ihsq
h v rs ihsq
xq qp
th
t vs
hv rs ihsq
hvu vqp
qpyxwh
t v s h
hs rpp
h vu qp h
E t
tqs r qp ih
qpyxwh
Page 36
Roll No:_____________________
OOAD LAB
14. COMPONENT DIAGRAMS They provide a physical view of the current model. A component diagram shows the organizations and dependencies among software components, including source code component, binary code component, and executable component. These diagrams also show the externally visible behavior of the component by displaying the interfaces of the components. Component diagrams contain: 1. Component package 2. Components 3. Interfaces 4. Dependency relationship 1. Co ponent package:- component package represents clusters of logically related components, or major pieces of our system. Component packages parallel the role played by logical packages for class diagrams. They allow us to partition the physical model of the system. Typically, a component package name is the name of a file system directory. The component package is a folder shaped icon.
2. Co ponents:- A component represents a software module (source code, binary code, executable, dll, etc.) with a well defined interfaces. The interfaces of the component are represented by one or several interfaces elements that the component provides. Components are used to show the compiler and runtime dependencies as well as interface and calling dependencies among software modules.
Page 37
Roll No:_____________________
OOAD LAB
Interface circle attached to the component icon means that the component supports that particular interface. Co ponent ste eotypes:- A system may be composed of several software modules of different kinds (.exe files, .dll files etc). To distinguish different kinds of software modules from each other, component stereotypes are used. By default, the following stereotypes types of components are available. a) Main program b) Sub program c) Packages d) Tasks e) EXE f) DLL a) Package:- A software component of the type package consists of a specification module and an implementation module; the implementation module often referred to as body. By default, a class is declared in a package.
b) DLL:- A dll component stereotype represents a data link library (a .dll file).
Page 38
Roll No:_____________________
OOAD LAB
c) Ma n p og a :- This component represents a file that contains the root of the program. There is only one main program component per program.
d) Sub p og a :- Sub program components corresponds to sub routine declarations. Sub programs generally contain single or grouped sub routines; they do not contain class definitions.
e) Task:- Task components represents package with independent thread of control. If task are compiled differently than regular packages, we can allocate a class definition to a task.
Page 39
Roll No:_____________________
OOAD LAB
3. Inte face:- An interface specifies the externally-visible operations of a class or component and has no implementation of its own. An interface typically specifies only a limited part of behavior of a class or component. Interfaces belonging to the logical view but can occur in class, use case and component diagram.
d
4. Dependency elat onship:- A dependency relationship between two model elements in which a change to one model element will affect the other model element. Use a dependency relationship to connect model elements with the same level of meaning.
f e
Page 0
Roll No:_____________________
OOAD LAB
ATM
.exe file
ATM Transaction
.h file
database
change pwd
Bal enquiry
Withdrawl
Page 1
Roll No:_____________________
OOAD LAB
Hospital
.h file
Database general checkup perform surgery prescribe tests prescribe medicines maintain doc records Bill payment Supply medicines
Page 2
Roll No:_____________________
OOAD LAB
16. DEPLOYMENT DIAGRAM A deployment diagram shows processors, devices and connections. Each model contains a single deployment diagram which shows the connections between its processors and devices and its processes to processors. Processor:- A processor is a hardware component capable of executing programs. Each processor must have a name, there are no constraints on the processor name because processors denote hardware rather than software entities. The icon for processor is a shaded box.
Device:- A device is a hardware component with no computing power. Each device must have a name. Device names can be generic, such as modem or terminal . The icon of device is a box.
Connection:- A connection represents some type of hardware coupling between two entities. An entity is either a processor or a device. The hardware coupling can be direct such as an RS232 cable or indirect such as satellite -toground communication. Connections are usually bidirectional. The icon for connection is a straight line.
Page 3
Roll No:_____________________
OOAD LAB
ATM Machine
Modem
Server
ATM card
Page
Roll No:_____________________
OOAD LAB
18. FORWARD ENGINEERING Forward engineering implies converting the models into software code. This process is usually done by mapping. Procedure: 1. First add Rose C++ using AddIn->Addin manager 2. select class diagram, goto Tools->C++->code generation 3. Again select class diagram, goto Tools->C++->Browser Header
Example-18.1:-
Student Rollno : int Name : char[20] Branch : char[5] Enrollment() Attend classes() Attend exams()
Output:Student.h #ifndef Student_h #define Student_h 1 class Student { public: Student(); Student(const Student &right); ~Student(); Student & operator=(const Student &right); int operator==(const Student &right) const; int operator!=(const Student &right) const;
Page
Roll No:_____________________
OOAD LAB
protected : private: const int get_Rollno () const; void set_Rollno ( int value); const char* get_Name () const; void set_Name ( char* value); const char* get_Branch () const; void set_Branch ( char* value); private: int Rollno; char Name[20]; char Branch[5]; }; inline const int Student::get_Rollno () const { return Rollno; } inline void Student::set_Rollno ( int value) { Rollno = value; } inline const char* Student::get_Name () const { return Name; } inline void Student::set_Name ( char* value) { Name = value; } inline const char* Student::get_Branch () const { return Branch; } inline void Student::set_Branch ( char* value) { Branch = value; } #endif
Page 6
Roll No:_____________________
OOAD LAB
Teaching()
Cleaning() Incharge()
Output:Staff.h #ifndef Staff_h #define Staff_h 1 class Staff { public: Staff(); Staff(const Staff &right); ~Staff(); Staff & operator=(const Staff &right); int operator==(const Staff &right) const; int operator!=(const Staff &right) const; protected : private: const int get_Id () const; void set_Id (int value); const char* get_Name () const; void set_Name ( char* value); const char* get_Subject () const; void set_Subject ( char* value); const int get_Dept_Id () const; void set_Dept_Id ( int value);
Teaching S aff
h
Page 7
Roll No:_____________________
private int Id; char Name[10]; char Subject[10]; int Dept_Id; }; inline const int Staff::get_Id () const { return Id; } inline void Staff::set_Id ( int value) { Id = value; } inline const char* Staff::get_Name () const { return Name; } inline void Staff::set_Name ( char* value) { Name = value; } inline const char* Staff::get_Subject () const { return Subject; } inline void Staff::set_Subject ( char* value) { Subject = value; } inline const int Staff::get_Dept_Id () const { return Dept_Id; } inline void Staff::set_Dept_Id ( int value) { Dept_Id = value; } #endif
OOAD LAB
Teaching Staff.h #ifndef Teaching_Staff_h #define Teaching_Staff_h 1 #include " Staff.h" class Teaching_Staff : public Staff { public: Teaching_Staff();
Page 8
Roll No:_____________________
Teaching_Staff( const Teaching_Staff &right); ~Teaching_Staff(); Teaching_Staff & operator=(const Teaching_Staff &right); int operator==(const Teaching_Staff &right) const; int operator!=(const Teaching_Staff &right) const; void Teaching (); protected : private: private: }; #endif Non Teaching Staff.h #ifndef Non_Teaching_Staff_h #define Non_Teaching_Staff_h 1 #include " Staff.h" #include "Teaching Staff.h" class Non_Teaching_Staff : public Teaching_Staff, public Staff { public: Non_Teaching_Staff(); Non_Teaching_Staff( const Non_Teaching_Staff &right); ~Non_Teaching_Staff();
OOAD LAB
Non_Teaching_Staff & operator=(const Non_Teaching_Staff &right); int operator==(const Non_Teaching_Staff &right) const; int operator!=(const Non_Teaching_Staff &right) const; void Cleaning (); void Incharge (); protected : private: private }; #endif
Page 9
Roll No:_____________________
OOAD LAB
Car Brand name : ar[20] Num ate : ar[10] Insurance num : int
W eels
Radius : int
Rotates()
Output:
Car.h
class Car { public: Car(); Car(const Car &right); ~Car(); Car & operator=(const Car &right); int operator==(const Car &right) const; int operator!=(const Car &right) const;
Page 0
Roll No:_____________________
OOAD LAB
const Engine get_the_Engine void set_the_Engine (Engine const Wheels get_the_Wheels void set_the_Wheels (Wheels protected : private:
const char* get_Brand_name () const; void set_Brand_name ( char* value); const char* get_Num_plate () const; void set_Num_plate ( char* value); const int get_Insur ance_num () const; void set_Insurance_num ( int value);
private: char Brand_name[20]; char Num_plate[10]; int Insurance_num; Engine the_Engine; Wheels the_Wheels; };
inline const char* Car::get_Brand_name () const { return Brand_name; } inline void Car::set_Brand_name ( char* value) { Brand_name = value; } inline const char* Car::get_Num_plate () const { return Num_plate; } inline void Car::set_Num_plate ( char* value) { Num_plate = value; } inline const int Car::get_Insurance_num () const { return Insurance_num; }
Page 1
Roll No:_____________________
inline void Car::set_Insurance_num ( int value) { Insurance_num = value; } inline const Engine Car::get_the_Engine () const { return the_Engine; } inline void Car::set_the_Engine (Engine value) { the_Engine = value; } inline const Wheels Car::get_the_Wheels () const { return the_Wheels; } inline void Car::set_the_Wheels (Wheels value) { the_Wheels = value; } #endif
OOAD LAB
Engine.h #ifndef Engine_h #define Engine_h 1 #include "Car.h" class Engine { public: Engine(); Engine(const Engine &right); ~Engine(); Engine & operator=(const Engine &right); int operator==(const Engine &right) const; int operator!=(const Engine &right) const;
void Runs_car (); const Car * get_the_Car () const; void set_the_Car (Car * value);
Page 2
Roll No:_____________________
protected : private: const char* get_Brand_name () const; void set_Brand_name ( char* value); private: char Brand_name[10]; Car *the_Car; };
OOAD LAB
inline const char* Engine::get_Brand_name () const { return Brand_name; } inline void Engine::set_Brand_name ( char* value) { Brand_name = value; }
inline const Car * Engine::get_the_Car () const { return the_Car; } inline void Engine::set_the_Car (Car * value) { the_Car = value; } #endif
Wheels.h
class Wheels { public: Wheels(); Wheels(const Wheels &right); ~Wheels(); Wheels & operator=(const Wheels &right);
Page 3
Roll No:_____________________
OOAD LAB
int operator==(const Wheels &right) const; int operator!=(const Wheels &right) const; void Rotates (); const Car * get_the_Car () const; void set_the_Car (Car * value); protected : private: const int get_Radius () const; void set_Radius ( int value); private: int Radius; Car *the_Car; }; inline const int Wheels::get_Radius () const { return Radius; } inline void Wheels::set_Radius ( int value) { Radius = value; } inline const Car * Wheels::get_the_Car () const { return the_Car; } inline void Wheels::set_the_Car (Car * value) { the_Car = value; }
#endif
Page
Roll No:_____________________
OOAD LAB
It involves converting the developed code into models. Procedure: 1. Write the code in notepad. Save it in C:/program files/Rational/Rose/C++/designs/ filename.cpp 2. Tools->C++->Reverse engineering 3. File->new Files->Rose (select filename then click add-selected then select filename and click add-current, finally OK) 4. select filename and press F3(Action->Analyse) for compilation. Then press F8(Action->Export) for running then press OK. 5. Goto rational rose, File->open->path(C:/program files/Rational/Rose/C++/designs)then click F8
Example 1:Class employee { Private: Int id; Char name[20]; Public : Getdata(); };
Kakatiya Institute of Technology and Science Page
Roll No:_____________________
OOAD LAB
e m p lo ye e id : in t n a m e : ch a r [2 0 ] G e td a ta ()
Roll No:_____________________
OOAD LAB
Public: Putdata(); };
n ts taff y : in t D is p la y()
ts ta ff x : in t P u td a ta()
Page 7
Roll No:_____________________
OOAD LAB
Example3 :- Aggregation Class car { Public: Char brand_name[20]; Char num_plate[10]; Int ins_num; Class Engine E; Class Door D; Class Wheel W; }; Class Engine { Private: char br_type[10]; Public: void runs_car(); }; Class Door { Public: void open(); Void close(); }; Class Wheel {
Page 8
Roll No:_____________________
OOAD LAB
Output:
Page 9
Roll No:_____________________
OOAD LAB
CASE-STUDY
Page 60
Roll No:_____________________
OOAD LAB
Functional Requirements The functional requirements are organized in two sections; First requirements of the ATM and second requirements of the bank computer. * Requirements of the ATM - authorization process - transaction (withdrawal process) * Requirements of the bank computer - authorization process (bank code and password) - transaction
Non-functional Requirement The non-functional requirement is bellowed. * The ATM network has to be available 24 hours a day. * Each bank may be processing transactions from several ATMs at the same time. * The ATM must be able to use several data formats according to the data formats that are provided by the database of different banks.
Page 61
Roll No:_____________________
OOAD LAB
Syste
startup
T ransaction
Bank
ithdrawl
eposit
T ransfer
Enquiry
Page 62
Roll No:_____________________
OOAD LAB
A State CustomerNum er Current Customer AccountBank Start State Pin State Account State Transact State ATM() setCustomerNum er() selectCustomer() selectAccount() ithdraw() Deposit() setState()
Bank cus omers ACus omers Bank() readCus omers() addCus omers() findCus omer() Cus omer C eckingAccount SavingsAccount customerNum er pin accounts Coustomer() match() getAccount() ..* BankAccount Balance BankAccount() deposit() withdraw() getAccount()
ATM Simulation
Page 63
Roll No:_____________________
OOAD LAB
Da abase
Va da e Ok how Op ons Choose Op on e ec W hdraw En er Amoun Check Ba ance Va da e Ok ece ve Cash ema n ng ba ance Ba ance p
Page 6
Roll No:_____________________
OOAD LAB
5: Show Options
Atm Interface
1: Insert Card 6: Choose Option 7: Select Withdrawl 2: Enter Pin 8: Enter Amount 11: Receive Cash 13: Balance Slip 4: Validate Ok 10: Validate Ok 12: Remaining balance Database : User 3: Validate Pin 9: Check Balance
Page 6
Roll No:_____________________
OOAD LAB
i ert car
e ter i
ali
m re tra acti
Page 66
Roll No:_____________________
OOAD LAB
balance
mini statement
Page 67
Roll No:_____________________
OOAD LAB
ustomer may be ATM card holder,credit,debit card holder or oline user of bank
k
ATM Machine
ustomer onsole
ard Reader
k
Employee onsole
k
WebPage
Each bank employee given a desktop and provided with id,pwd to login into database
Bank Database
Page 68
Roll No:_____________________
OOAD LAB
application, or from an outside number. Assume that the cell phone data comes from previous field monitoring and testing procedures (although randomly generated data or keyed input are other possible data capture sources). Functional Requirements: Cellular Network: A cellular network is a network distributed over land areas called cells, each served by at least one fixed-location known as a or . When joined together these cells provide radio coverage over a wide geographic area. Place Phone call:User places a phone call to the receiver and the cellular network identifies this phone call.
Page 69
Roll No:_____________________
OOAD LAB
Receive phone call: User recieves a phone call from the sender and the cellular network identifies this phone call. Place Conference Call: User places a onference call if he need and the cellular network identifies it. Receive additional Call: when reciever is on call and gets an additional call then he holds the present call and receive the additional call.
Non Functional Requirements: a) System should be designed simple enough to enable User to operate the phone without any formal training or delay. b)System must handle Network and power failure. c)System must be efficient to use and provide quick recover from the fault. d) Software must validate and cancel operation in case of incorrect member details,incomplete transaction, and time delay and return failure. e)User interface screen must be designed to operate easily. It should have visual appealing.
Page 70
Roll No:_____________________
OOAD LAB
<<extend>> Place Phone call Cellular network <<extend>> Receive phone call Receive additional call Place conference call
Page 71
Roll No:_____________________
OOAD LAB
Display
CRDisplay
Page 72
Roll No:_____________________
OOAD LAB
Send:Button
:Dialer
:Cellular Radio
DispayCRDi splay
Page 73
Roll No:_____________________
OOAD LAB
2: Send() :Dialer
3: Connection(pno)
Page 7
Roll No:_____________________
OOAD LAB
Busy
Ringingtone
Response
Indicate no balance
Balance Out
After Completion
Page 7
Roll No:_____________________
OOAD LAB
idle
Off-hook
On-hook
Busy
Busy
Connecting
Ringing
Destination Alerted
Time-out
Page 76
Roll No:_____________________
OOAD LAB
Network User
Make Call
Receive Call
Use Scheduler
Page 77
Roll No:_____________________
OOAD LAB
Control console{0 *}
ooo
Central Server
Page 78
ooo
Cell Phone
GPS Controller
GPS ocator {0 *}
Roll No:_____________________
OOAD LAB
Problem Statement:
At the beginning of each semester students may request a course catalogue containing a list of course offerings for the semester. Information about each course, such as professor, department, and prerequisites will be included to help students make informed decisions. The new on-line registration system will allow students to select four course offerings for the coming semester. In addition, each student will indicate two alternative choices in case a course offering becomes filled or canceled. No course offering will have more than ten students. No course offering will have fewer than three students. A course offering with fewer than three students will be canceled. Once the registration process is completed for a student, the registration system sends information to the billing system, so the student can be billed for the semester. Professors must be able to access the on-line system to indicate which courses they will be teaching. They will also need to see which students signed up for their course offering. For each semester, there is a period of time that students can change their schedules. Students must be able to access the on-line system during this time to add or drop courses. The billing system will credit all students for courses dropped during this period of time. Functional Requirements: Maintain curriculum: This use case is started by the registrar. It provides the capability to create, review, modify, and delete a list of course offerings for a given semester. Maintain Student Information: This use case is started by the registrar. It provides the capability to create, review, modify, and delete student information. Maintain Staff Information: This use case is started by the registrar. It provides the capability to create, review, modify, and delete staff information.
Register for programmer: The use case is started by the student. It provides the capability to create, review, modify, and delete a course schedule for a specified semester.
Kakatiya Institute of Technology and Science Page 79
Roll No:_____________________
OOAD LAB
Write exam: This usecase is started by the student. It provides the capability to write exam. Pay Fee: This usecase is started by the student. It provides the capability to pay fee.
NonFunctional Requirements:
y y
y y
System should be designed simple enough to enable staff to operate enqiry screen without any formal training or delay. System must be secured and protected from the staff and other unauthorized users.A student is allowed only to view and restricted to access/insert/update the other part of the system. Student is not necessary to maintain the staff information,student information and curriculum. Registrar is not necessary to pay fee and write exam.
Page 80
Roll No:_____________________
OOAD LAB
maintain currirculum
student
write examination
pay fee
Page 81
Roll No:_____________________
OOAD LAB
as a
1 1 *
rr t t x wv v
1 assigned to
att
teach
rr
1 *
rr
1 *
rr
rr
1 *
t u ss
1 *
provid
rr
rr
1 *
head of
1 *
Page 82
Roll No:_____________________
OOAD LAB
student
appli ation
inteview
admission
1: send 2: attend
3: [pass]admit
Page 83
Roll No:_____________________
OOAD LAB
3: [pass]admit 2: attend
inteview
admission
Page 8
Roll No:_____________________
OOAD LAB
intialization
z{
do intialize batch
open
entr register student e it/ increment student
cancel cancel
[c=n]
canceled
z
close cancel
do/ finalize batch
end
Page 8
Roll No:_____________________
OOAD LAB
registration main
courses
registration executable
student
Page 86
Roll No:_____________________
OOAD LAB
Page 87
Roll No:_____________________
OOAD LAB
Problem Statement: Due to budget cutbacks and general concern for providing the best service possible to the public, we as a hospital would like to ensure that we are using our scarce hospital resources in the most efficient manner possible. With this in mind we would like you to design a system which will help us manage our hospital in an efficient, effective manner. Specifically the system should help us schedule and monitor the various resources that we have at the hospital. This includes keeping track of available beds, waiting lists for patients, patients expected length of stay, scheduling of surgeries, patient notification and billing, scheduling of nurses and doctors. This function of the Hospital Management Information System deals with registering new patients, for either OPD or IPD and issuing unique identification numbers to the patients. These numbers are unique throughout the system. A patient can be registered either at the IPD front office or at the OPD reception. The OPD or IPD identification number is also created for each of the patient's separate visits. This also serves as a part of patient registration. The IPD/OPD ID is used for tracking the medical records of the patient for that particular OPD visit or IPD admission. All medical records of the patient are identified by a combination of numbers, i.e. Patient ID and OPD/IPD ID. The numbers allow for a flexible search in terms of finding the patient's history record. Functional requirements: Prescription: This Module handles various activities such as Doctor Diagnoses the patient, gives treatment & gives suggestions to the patients & prescribes laboratory tests& medicines. Operation This is initiated by the doctor and diagnosing the patients. undergoes the various operations by
Page 88
Roll No:_____________________
OOAD LAB
Checking: This is initiated by doctor who treats patients came for checking. Patients tells the problem so that the doctor gives prescription according to his problem. Receptionist: The person who gives the details of doctors, requirements available in the hospital, gives the appointment to the patient and collects the fee from the patient.
NonFunctional requirements a)System should be designed simple enough to enable receptionist to operate enqiry screen without any formal training or delay. b)System must be secured and protected from the staff and other unauthorized users.A patient is allowed only to view and access the enquiry and restricted to access /insert/update the other part of the system. c)Staff members must know the correct functioning of the equipments in the hospitai. d)Doctors must be available in any critical situation.
Page 89
Roll No:_____________________
OOAD LAB
Page 90
Roll No:_____________________
OOAD LAB
has a
ambulance
has a
has a
is a
Page 91
Roll No:_____________________
OOAD LAB
Sequence Di
Doctor Patient
Patient Doctor
6: Gives prescription
ti
I stitut
Roll No:_____________________
OOAD LAB
3 rf r 6 r f 5 r r r
, rf r
Page 93
Roll No:_____________________
OOAD LAB
Doc or
ye
Pre cription
Pre cr ptio n
Page 9
Roll No:_____________________
OOAD LAB
Page 9
Roll No:_____________________
OOAD LAB
Receptionist PC
Page 96
Roll No:_____________________
OOAD LAB
Problem Statement: Problems that are facing by the users while using the current Library system. The current system of the university doesnt allow users to login from different campuses. 1. As it is not available online every student calls up to find out if the book is available or not. - Too many calls to answer 2. Every time a student calls for a book you have to check the racks for the availability of the book. - Too much of physical work. . If some one reserves the book, hes not sure if he definitely can get the book as the previous student may not return in time. 4. Either the student has to call or come to the library to reserve the book, but cannot reserve online over the internet. . Fines have to be calculated manually. . Students have no idea to check their account. Functional Requirements: a)Member of library All the staff and student members of the college can become a member and obtain the library card of library by showing id card issued by the college. b)Article A college library has books,journals audio and vedio and cassettes and DROMS.They are collectively called as articles in the library. c)Lend Article A library member can borrow maximum of 4 books for the period of 1 days. d)Return of the Article A library member can return an article. In case of default over due charges will be levied. e)Renewal of Article A library member can renew the article borrowed,when other library members donot reserve it. f)Loss of Article Loss of Issued Articles should be reported immediately to the librarian. g)Loss of Member card Loss of Member card should be reported immediately to the librarian. h)Enquiry Library member can enquire about the articles details availability and their possible return dates in case of issued.
Page 97
Roll No:_____________________
OOAD LAB
i)Reservation A Library member can reserve an article that is not currently available in the library. Non-Functional Requirements a) System should be designed simple enough to enable library member to operate enquiry screen without any formal training or delay. b)System must be secured and protected from library members and other unauthorized users. A member is allowed only to view and access the enquiry and restricted to access/insert/update the other part of system.A member can borrow, reserve or return book only through a librarian. c)System must handle Network and power failure. d)System must be efficient to use and provide quick recover from the fault. e) Software must validate and cancel operation in case of incorrect member details,incomplete transaction, and time delay and return failure. f)User interface screen must be designed to operate easily. It should have visual appealing.
Page 98
Roll No:_____________________
OOAD LAB
Enquiry
MakeReservation Me ber
Article Renewal
Librarian
Re ove reservation
Lend article
Return of article
Page 99
Roll No:_____________________
OOAD LAB
0..*
0..* Updat s
}
c py f
~ ~
0..*
Title Titleid type copies price aut or publications edition reservedcopies issuedcopies
r s rv s
Utiliz s
Page 100
Roll No:_____________________
OOAD LAB
: Librarian
Front Panel:Lend...
: itle
: rticle
: ember
1: Lending details( itle, ember) 2: Validate:Find Borrowing Limit 3: Borrow limit ok 4: Find availability 5: vailable OK 6: Update issue details 7: Update available copy
9: Close
Page 101
Roll No:_____________________
OOAD LAB
4: Find availability 1: Lending details(Title,Member) 7: Update available copy 9: Close Front Panel:Lending :Title Window 5: Available OK : Librarian
:Article
:Member
Page 102
Roll No:_____________________
OOAD LAB
Reserved
Page 103
Roll No:_____________________
OOAD LAB
start
IF
available
Issue article
not available
Page 10
Roll No:_____________________
OOAD LAB
Librarian
Member
Library database
Article renewal
Remove Reservation
Return Article
Make reservation
Enquiry
Page 10
Roll No:_____________________
OOAD LAB
Node 2: Counter PC
Page 106
Roll No:_____________________
OOAD LAB
Problem Statement: A Ticket Vending System(TVM) dispenses tickets to passengers at a railway station.Passengers use the front panel to specify their oarding and destination place,details
of passengers(number of adults and children) and date of travel.The machine displays the fare for the requested ticket.The passengers then deposits cash in the bin provided and presses accept cash.The machine checks the cash,if it is more,the balance cash is paid out.And the ticket requested is printed.The system is also used by the operator who might want to knowthe cash held in the machine,the break-up of small change available in the machine,withdraw or deposit cash when need.And the report options also include the detailed report of trasactions,summary report of the number of tickets sold for each destication,opening balance,each collected,cash dispensed and current balance in the machine.
Functional Requirements:
Specify
Ticket
details:Initiated
by
the
passengers
and
gives
the
following
details:Destination place,date of journey,passengers details(adults,child) and coach details. Buy ticket:Initiated by the passenger to buy ticket,the passenger pays cash and presses accept cash button.the system checks out the cash and print out the ticket and dispense the balance if any.The system also updates the records to reflect the number of tickets to each designation,the total cash collected,total cash dispensed,current balance etc., Summary report:Initiated by the operator to know the summary of the total business transacted for the day,the cash collected and balance cash available in the system. Get cash details: Initiated by the operator to get a denomination wise number of notes and
coins available with the machine at that time. The operator connects from a remote place to vending machine to get cash details.
Withdraw cash: Initiated by the operator to withdraw cash from the machine. The operator connects to the machine locally and the machine dispenses cash.
Page 107
Roll No:_____________________
OOAD LAB
Deposit cash :Initiated by the operator to deposit cash in the machine. The operator connects to the machine locally and specifies the amount to be deposited with the denomination details. Check Master files: Initiated by the system administrator. System administrator can log in from a remote place and check the details of machine-id, user-id, password and ticket, balance details. Update Master: Initiated by the system administrator to update system details. Non Functional Requirements: a) System should be designed simple enough to enable operators to get summary reports,get chas details, withdraw cash and deposit cash without any delay. b)System must be secured and protected from passengers and other unauthorized users. A passenger is allowed only to enquire ticket details and buy ticket. c)System Administrator must only check and update master files. d)System must handle Network and power failure. e)System must be efficient to use and provide quick recover from the fault. f) Software must validate and cancel operation in case of incorrect passenger details,incomplete transaction, and time delay and return failure. g)User interface screen must be designed to operate easily. It should have visual appealing.
Page 108
Roll No:_____________________
OOAD LAB
specific ticket details Passenger y ticket check master files Summary report System Administrators
Withdraw cash
Deposit Cash
Page 109
Roll No:_____________________
OOAD LAB
rontPanel
ah Denomination
Re uistionslip startingplace destinationplace tra eldate passenger[ ] age[ ] remark[ ] fare Printer
Report
Summary
Receipt
De itNote
Page 110
Roll No:_____________________
OOAD LAB
7 8
Page 111
Roll No:_____________________
OOAD LAB
6 Fare 3 PrepareSlip
Page 112
Roll No:_____________________
OOAD LAB
Start
Pay cash
Page 113
Roll No:_____________________
OOAD LAB
Operator
Passenger
TicketVendingDatabas e
Deposit Cash
Withdraw cash
Summary Report
Buy Ticket
Ticket Details
Page 11
Roll No:_____________________
OOAD LAB
server1
server2
server3
Page 11
Roll No:_____________________
OOAD LAB
Problem Statement
The Trading System must take care of sales information of the company and must analyze the potential of the trade. A Trading System processes live market data from the Data Provider using compute resources hosted by the Compute Provider, running software from the Software Provider to supply processed data to the customer. A Trading System demands a high availability of resources. Non-availability of resources means an absence in market trading which, in turn, can lead to missed opportunities. Security is of paramount importance. In addition, regulatory issues exist within institutions that place restrictions on the accessibility of spatial information across their distributed enterprises.
Functional Requrements: Place order: This module is initiated by the customer to place a order. Track order: This module is initiated by the customer to track order. Ship order: This module is initiated by the customer in which all orders will be shipped without delay. Ship Partial order:This module is initiated by customer in which all orders will be shipped partially. Bill customer: This module is initiated by customer to bill the consumer (for credit card use only). Validate customer: This module is initiated to check for the validation of the customer Non Functional Requrements: a)System should be designed simple enough to enable customer to operate enqiry place, track, ship, partial ship order without any delay. b)System must be secured and protected from the customer and other unauthorized users.A student is allowed only to view and restricted to access/insert/update the other part of the system.
Page 116
Roll No:_____________________
OOAD LAB
c)System should handle Network and power failure. d)Software must be efficient to use and provide quick recover from the fault.
Page 117
Roll No:_____________________
OOAD LAB
Place order
<<include>> <<include>>
Track order
Ship order
Customer
Bill customer
Page 118
Roll No:_____________________
OOAD LAB
Places
Page 119
Roll No:_____________________
OOAD LAB
Order fulfillment
Billing agent
Page 120
Roll No:_____________________
OOAD LAB
1: Sub it Order
Order taken
usto er : usto er
2: Place order
illing agent
Page 121
Roll No:_____________________
OOAD LAB
Customer
Sales
Fill order
Pay
Deliver Order
Collect order
Page 122
Roll No:_____________________
OOAD LAB
Customer
Sales Person
Trading Database
Give rder
Place rder
Track rder
Bill customer
Page 123
Roll No:_____________________
OOAD LAB
Page 12