Sie sind auf Seite 1von 69

ACADEMIC YEAR 200 200

DEPARTMENT OF
COMPUTER SCIENCE AND ENGINEERING


























OOPS THROUGH UML LAB MANUAL









PREFACE


UML is a language used for visualizing, specifying, constructing, and
documenting the artifacts of a software intensi ve system.

This manual is designed and developed under the syllabus pattern
introduced by Jawaharlal Nehru Technological Uni versity for the V
semester B.Tech Computer Science and Engineering department for the
Language Processor Lab . This manual is indented for an introductory
course in OOPS through UML at the graduate level students. It provides to
a way to represent the artifacts of a software intensi ve system in a
standardized manner.

The primary purpose of this manual is creating a comprehensi ve
understanding of the OOPS concepts with their application in UML along
with mapping it to various programming languages.

We are liabl e to convey our sincere thanks to our H.O.D. and all the
staff members of CSE for their helping hands to produce this successful
manual.










STAFF INCHARGE HOD/CSE PRINCIPAL









OOPS LAB THROUGH UML

TABLE OF CONTENTS

S.NO

TITLE PAGE NO

1.



2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.


Introduction

List of programs:

Airlines Reservation System
ATM Model
Auction Application
Course Registration
Online Book Shop
Personal Computer Model
Plant Model
Point Of Sale
Simulated Company
Student Model
Telephone Dialing


5




11
27
37
39
43
54
55
56
31
58
67
68


















OOPS LAB THROUGH UML

CALENDER

S.NO TITLE DATE REMARKS


1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.


Airlines Reservation System
ATM Model
Auction Application
Course Registration
Online Book Shop
Personal Computer Model
Plant Model
Point Of Sale
Simulated Company
Student Model
Telephone Dialing






INTRODUCTION TO UML

UML is a language used for visualizing, specifyi ng, constructing and
documenting the artifacts of a software intensi ve system.


Building Blocks of UML :

Things
Relationships
Diagrams

Things in UML :
Structural things
i. Classes
ii. Interfaces
iii. Collaborations
iv. Use Cases
v. Active Classes
vi. Components
vii. Nodes Classes

Behavioral things
i. Interactions
ii. State machines

Grouping things
i. Packages

Annotational things
i. Notes
Relationships in UML :
Dependency
Association
Generalization

Diagrams in UML :
Class Diagram
Object Diagram
Usecase Diagram
Sequence Diagram
Collaboration Diagram
Statechart Di agram
Acti vity Diagram
Component Diagram
Deployement Diagram





MyFrame
height : int =300
width : int =400
status : int =1
title : String ="Demo Frame"
MyFrame() : MyFrame
open(void) : void
close(int status) : void
resize(int height, int width) : void
minimize(void) : void
maximize(void) : void


MouseListener
mouseClicked()
mousePressed()
mouseReleased()
mouseEntered()
mouseExited()
(from event)
<<Interface>>







Place Order




OrderForm.java



File Server








Grouping things are the organizational parts of UML
models. These are the boxes into which a model can be
decomposed. In all, there is one primary kind of grouping
thing, namely, Packages.



java.swing.*

Annotational things are the explanatory parts of
UML Models. These are the comments you may apply to
describe and illuminate about any element in a model.



return copy of self


















LAB EXERCISES

1. Airlines Reservation System

Add sequence diagram :-
administrator addform addcontroller errormessage passenger DB
requestfieldvalues()
enter_field_values()
validate()
invalid()
Display_error_messages()
valid_add_record()

Delete sequence diagram :-


administrator deleteform deletecontroller errormessages passengerDB
request_key_field()
enter_key_field()
validate()
invalid()
display_error_messages()
valid_delete_record()

Fight Database Maintanance :-


administrator domainform domaincontroller
request_operator()
specify_operation()
add()
sequence
diagram
delete()
sequence
diagram
update()
sequence
diagram

Update sequence diagram :-


Mo
administrator updateform updatecontroller errormessages flight DB
request_key_field()
enter_key_field()
validate()
lookup()
query_result()
no_such_record()
recordexist_displayrecord()
edit_details()
validate()
invalid()
valid_update_record()

Mode of payement sequence diagram :-


reserver reservation form reservation
controller
banking details error messages printer banking DB
request_mode_of_payment()
select_mode_of_payment()
select_mode()
if_credit_cord()
request_banking_details()
enter_bank_details()
lookup()
query_result()
invalid()
if_valid()
diveconfirmation()
if_cash()
deliver_ticket()

Add collaboration diagram :


administrator
addform addcontroller
errormessages
passenger DB
1: request_field_values()
2: enter_field_values() 3: validate()
6: valid_add_record()
4: invalid()
5: displat_error_messages()

Delete collaboration diagram :-
administrator
updateform
updatecontroller
errormessages
flight DB
1: request_key_field()
2: enter_key_field()
8: edit_details()
3: validate()
7: recordexist_displayrecord()
9: validate()
6: no_such_record()
10: invalid()
4: lookup()
5: query_result()
11: valid_update_record()

Update collaboration diagram:-
administrator updateform updatecontroller
errormessages
passengers DB
1: request_key_field()
2: enter_key_field()
8: edit_details()
3: valid()
7: recordexit_displayrecord()
9: validate()
4: lookup()
5: query_result()
11: valid_update_record()
6: no_such_record()
10: invalid()

Add(flight) Sequence diagram :-


addform administrator addcontroller errormessage flight DB
request_field_values()
enter_field_values()
validate()
invalid()
display_error_messages()
valid_add_record()

Update(flight) collaboration diagram:-
administrator
updateform
updatecontroller
errormessages
flight DB
1: request_key_field()
2: enter_key_field()
8: edit_details()
3: validate()
7: recordexist_displayrecord()
9: validate()
6: no_such_record()
10: invalid()
4: lookup()
5: query_result()
11: valid_update_record()

Booking collaboration diagram :-


5: lookup()
reserver welcomeform
reservationform
reservationcontroller
passenger DB
errormessages
flightDB
8: display_flight_details()
1: welcome_reservor() 2: request_details()
3: enter_details()
9: select_flight()
12: request_passenger_details()
13: enter_passenger_details()
15: mode_of_payment()
17: update_flight DB
18: unlock_the_record()
4: passplaces()
10: selected_flight()
14: process_passenger_details()
6: query_result()
11: look_selected_flight_record()
7: no_match_found()
16: store_passenger_details()

Login sequence diagram :-


administration loginform logincontroller welcomeform errormessages
request_details()
enter_details()
password_details()
valid()
invalid()
display_error_messages()

Maintain passenger Database sequence diagram :-


administrator domainform domaincontroller
enter_the_operation()
add()
sequence
diagram
delete()
sequence
diagram
update()
sequence
diagram

Maintain passenger database :-


administrator domainform domaincontroller
enter_the_operation()
add()
sequence
diagram
delete()
sequence
diagram
update()
sequence
diagram

Update passenger database sequence diagram :-


administrator updateform updatecontroller passenger DB errormessage
request_key_field()
enter_key_field()
validate()
lookup()
query_result()
no_such_record()
recordexist_displayrecord()
edit_details()
validate()
invalid()
valid_update_record()

Delete flight database sequence diagram:-



administration loginform logincontroller welcomeform errormessages
request_details()
enter_details()
password_details()
valid()
invalid()
display_error_messages()

Booking sequence diagram:-


reserver welcomeform reservationform errormessages passenger DB flight DB reservation
controller
welcome_reservor()
request_details()
enter_details()
passplaces()
lookup()
query_result()
no_match_found()
display_flight_details()
sellect_flight()
sellected_flight()
lock_sellected_flight_reserve()
request_paddenger_details()
enter_passenger_details()
process_passenger_details()
mode_of_payment()
store_passenger_details()
sequence
diagram
update_flight DB
unlock_the_reader()



Login collaboration diagram :-
administrator
loginform logincontroller
welcomeform
errormessages
1: request_details()
2: enter_details()
6: diaplay_error_messages
3: passdetails()
5: invalid()
4: valid()

Maintain passenger database collaboration diagram :-
administrator loginform
logincontroller
welcomeform
errormessages
1: request_details()
2: enter_details()
6: display_error_messages()
3: passdetails()
5: invalid()
4: valid()

Maintain flight database collaboration diagram :-
administrator domainform
domaincontroller
1: request_operation()
2: specify_operation()
3: add()
4: delete()
5: update

Delete flight DB collaboration diagram :-


administrator
deleteform deletecontroller
errormessages
flight DB
1: request_key_fields()
2: enter_key_fields() 3: validate()
6: valid_delete_record()
4: invalid()
5: displsy_error_messages()

Mode of payment collaboration diagram :-
reservor
reservationcontroller
bankingdetails banking DB
errormessages
reservationform
printer
5: request_bank_details()
6: enter_bank_details()
1: request_payment_details()
2: selected_mode_payment()
10: ifvalid()
11: diveconformation()
9: invalid_data()
7: lookup()
8: quert_result()
13: deliver_ticket()
3: selected_mode()
4:
12: ifcash()





















2. ATM MODEL :
Login sequence diagram:-
user login form login controller welcome
message
display error
message
database
1: user login()
2: request username & pswd()
3: enter username & pswd()
4: reffering the details of the users
5: validation of username & pswd
6: valid username & pswd
7: invalid username & pswd
8: display error message

Creating cards sequence diagram:-


manager user main form application form controller display error
message
1: enquiring details
2: providing details to user
3: requesting application form
4: providing application form
5: submission of application form for validation
6: valid application form
7: invalid application form
8: display error message
9: user refills the application form again

Creating codes sequence diagram:-


manager administrator verification assigning
codes
database
1: providing card information
2: verification
3: valid
4: updation of database
5: invalid

Selecting modes:-
users main form controller
1: display options of deposit & withdraw
2: select options
3: deposit option is selected
Sequence
diagram
4: withdraw option is selected
Sequence
diagram



Deposit sequence diagram :-
user controller ATM
1: user is used for amount
2: enter the amount
3: user is provided with various modes of payments
4: select modes of payments
5: selecting cash()
sequence
diagram
6: selecting cheque()
sequence
diagram

Deposit cash sequence diagram:-
user controller ATM database
1: insert cheque for verification
2: provides acknowledgement
3: cheque is provided to system
4: updating database

Withdraw sequence diagram :-


user controller ATM
1: user is asked for amount
2: enter amount
3: user is provided with various modes of payment
4: select mode of payment
5: selecting cash
Sequence
diagram
6: selecting cheque
Sequence
diagram

Withdraw cash sequence diagram:-
user ATM database
1: cash is provided from system
2: updating database

Login collaboration diagram:-


user
login
form
login
controller
welcome
message
display error
mesage
databas
e
1: user login
2: request username & pswd
3: enter username & pswd 5: validation of username & pswd
6: valid usrname & pswd
7: invalid username & pswd
4: reffering details of the user
8: display error message

Creating cards collaboration diagram:-
manager
user
main
form
applicatio
n form
controlle
r
display error
message
6: valid application form
1: enquiring details
2: providing details
5: sub mission of application form for validation
9: user refills the application form
8: display error message
3: requesting application form
4: providing application form
7: invalid application form

Creating codes collaboration diagram:-


manager
verificati
on
administ
rator
assigning
codes
databas
e
1: providing card information
3: valid
5: invalid
2: verification
4: updating database

Selecting method collaboration diagram:-


user
controlle
r
ATM
1: user is asked for amount
2: enter the amount
3: user is provided with various modes of payment
4: select mode of payment
5: selecting cash
6: selecting cheque

Deposit collaboration diagram:-
user
main
form
controlle
r
1: display options for deposit & withdraw
2: select options
3: deposit option is selected
4: withdraw option is selected

Deposit cheque collaboration diagram:-


user
controlle
r
ATM
databas
e
1: insert cheque for verification
2: provides acknowledgement
3: cheque is provided to system
4: updating database

Withdraw collaboration:-
user
controlle
r
ATM
1: user is asked for amount
2: enter the amount
3: user is provided with various modes of payment
4: select mode of payment
5: selecting cash
6: selecting cheque

Withdraw cash collaboration diagram:-


user
ATM
databas
e
1: cash is provided from the system
2: updating database



3. Auct i on Appl i cat i on :
Purchasers sequence diagram:-
purchaser auction mail negotiation
room
chatting database goodsroom
login
verifyuser
display goods
select goods
short the store of auction
enter chatting
bidding
select method of bidding
record contents
end of negotiation
broadcasting result

Collaboration diagram:-


purchaser
goodsroom
negotiation
room
auction
mail
chatting database
2: verify user
1: login
3: displaygoods
4: selectgoods
6: enter chatting
5: short the store of auction
9: record content od charting
7: bidding
8: select method of bidding



4. Cour se Regi st r at i on :
Login sequence diagram:-
User MainWindow LoginWindow LoginControl Welcome
Window
ErrorMessage
1: Logging In
2: Ask for user ID and Password
3: Verify user ID and password
4: Valid user
5: Invalid User
6: Error Message
7: Relogin / Cancel

Registration sequence diagram:-


Student Registration
Form
Error Message Form Control Database
1: Registration Form
2: Request Details
3: Enter Details
4: Validation
5: Verify Elective Details
6: Store Details
7: Confirm Message
8: Invalid Elective
9: Display Reason
10: Invalidate
11: Re-register

Course details sequence diagram:-


Student CourseForm CourseForm
Control
ErrorMessage Database
1: Select Course
2: Validate Course
3: Get Course Information
4: Display Course Information
5: Invalid Course
6: Display Error Message

Login collaboration diagram:-
User
Login
Window
Main
Window
Login
Control
Error
Message
Welcome
Window
1: Logging
3: Verification
2: Ask For ID
7: reLogin / Cancel
5: Invalid
4: Valid
6: Error Message

Registration collaboration diagram:-


Student Registration
Form
Form
Control
Error
Message
Databas
e
5: Verify Elective Details
1: Registration Form
2: Request Details
3: Enter Details
11: re-registration
4: Validation
7: Confirm Message
10: Invalid
8: Invalid Choice
6: Store Details
9: Display

Course details collaboration diagram:-
Student CourseForm
Control
Course
Form
Error
Message
Databas
e
1: SelectCourse
5: Display Course Information
6: Invalid
3: Get Course Infomation
4: Get Course Information
2: Validation
7: Display Error Message



5. Onl i ne Bookshop :
Login sequence diagram:-
user mainform loginform welcomeform logincontroller errorcontroller database
1:login()
2:enter username/password
3:authenticatio
4:enter into database
5:valid
6:invalid
7:error message
8:relogin

View reports sequence diagram:-


administrator mainform controller errormessages database
1:request id
2:enter id
3:verification
4:invalid
5:errormesage
6:re_enterid
7:verified
8:generate reports

View stock sequence diagram:-


cuatomer mainform
administrator
controller errormessages database
1:request book details
2:verify
3:not filled property
4:error message
5:verified
6:retrieve data

Maintain book stock sequence diagram :-


manager option form book profile
form
1:to avial option
2:add books
3:update books
sequence
diagram
sequence
diagram
4:delete books
sequence
diagrams

Add books sequence diagram :-


manager new book add
form
book controller error message database
1: request for new book
2:add new book
3:verification
4:not filled properly
5:error message
6:filled property
7:generate id

Modify books sequence diagram :-


manager selector form modification
form
modification
controller
errormessage database
1:request to select book
2:selecting book
3:intimate database
4:retrive data
5:modify
6:verification
7:improper
8:error message

Delete books sequence diagram :-


manager selector form deletion form database
1:select book
2:retriving data
3:deleting
4:update()

Login collaboration diagram:-


user loginform
mainform
welcomeform
logincontroller errormessage
database
1: login()
8: relogin
2: enter username/password
7: error message
3: authentication
5: valid
6: invalid
4: enter into database

View reports collaboration diagram:-
administrator mainform
controller
database
errormessage
1: requestid
2: enter id
6: re_enter id
5: error message
8: generate reports
3: verification
4: invalid id
7: verified

View stock collaboration diagram:-


user main form
administrator
controller
database
error
message
4: error message
1: request book details
6: retrieved data
2: verify
3: not filled properly
5: verified

Maintain book stock :-
manager option
book profile
form
1: to avail option
2: add books
3: update books
4: delete books

Add books collaboration diagram:-


manager new book
add form
book
controller
database
errormessage
1: request for new book
2: add new books
5: error message
7: generate id
3: verification
4: not filled property
6: filled properly

Modify collaboration diagram:-
manager selector
form
modification
controller
modification
form
database error
message
1: request to select book
2: selecting book
5: modifying
3: intimate database
6: verification
4: retrive database
8: error messages
7: improper modification

Delete collaboration diagram:-


manager selector
form
deletion
form
database
1: select book
2: retriving data
4: update()
3: deleting



6. PC Model



7. Pl ant Model



8. Poi nt Of Sal e :
Sequence diagram:-
cashier system tax collector credit authorization
service
accounts
1: make new sales()
2: enter item()
3: description()
4: end sales()
5: taxline items =getTaxes()
6: total wih Taxes()
7: make payment()
8: change receipt()
9: reply =request approval()
10: post receivable
11: post sales

Collaboration diagram:-


cashier
tax collector
credit authorization service
accouts
system
1: make new sales
2: enter items
3: description
4: end sales
6: total with taxes
7: make payments
8: change receipt
5: tax line item =getTaxes
9: reply =request approval
10: post receivable
11: post sales



9. Si mul at ed Company
Sequence Diagram for usecase 1:
:user disp : Display :Loan amount : Cash
Account
details : Compan
yDetails
requestLoan()
getDetails
returnDetails()
Loan(amt,dur)
credit(amt)
updateDisplay()
balance()
amount

Sequence diagram for usercase 2:


:user disp : Display amount : Cash
Account
MachineClass factory : Factory
purchaseMachine()
balance()
amount()
getStaticDetails()
cost, overload, output, rawcost
howManyMachines()
numberOfMachines
confirm
updateDisplay()
debitCost
addMachine(Machine)
balance()
amount



Simulated company for usecase 3:


:User disp:Display factory:Factory MachineClass market:Market production:Prod
uction
sales:Sales
nextTurn
capacity
mcoutput
output
number
projectedPrice()
nextTurn(numbertaken,price,salesprice)
getProductionDetails()
recordNumber()
recordSalesPrice()
getNumberInStock()
stock
getProjectedPrice()
projectedPrice()
getProjectedSales()
projectedSales()
adjustProjectedPrice()
setEndStock(number)
adjustProjectedSales() recordNumberSold(count)
calculate
grossProfit()



Instance level collaboration diagram:
: Simco
Cash : CashAccount
factory : Factory
Prod : ProductionRun
market : Market
sales : Sales
details : CompanyDetails
disp : Display
1: Create
2: setBalance(amount)
3: Create
4: Create
8: Create
5: Create
6: Create
7: Create

Specification level collaboration diagram:-
:Simco
/CompanyAccount :
CashAccount
/CompanyProductionRu
n : ProductionRun
/ProductionFactor
y : Factory
/MarketDetails :
Market
/SalesDetails :
Sales
/CompanyDetails :
CompanyDetails
/UserDisplay :
Display

Instance level collaboration diagram for usecase 1:


1: RequestLoan
: User
disp :
Display
: Loan
details : Company
Details
cash : Cash
Account
2: 3 : Loan ( amount,duration)
3: 5 : addLoan(Loan)

Specification level collaboration for usecase 1:
/UserDisplay :
Display
Loan
/CompanyAccount :
CashAccount
/companyDetails :
CompanyDetails
1...* 1...*
1...*

Instance level collaboration diagram for usecase 2
:User
disp : Display
cash : CashAccount
:Machine
factory : Factory
:Machine
Class
1: Purchase Machines
8: Machine
7: numberOfMachines :=howManyMachines()
3: cost =mCost()
4: output =moutput()
5: o_h : mOverhead()
6: rawCost : mcrawcost()
2: Balance()
9: debit(cost)
10: addMachine(Machine)



Specification level collaboration for usecase 2:
/UserDisplay :
Display
:Machine
Class
Machine
/CompanyAccount :
CashAccount
/ProductionFactor
y : Factory
1...*
1...*
1...* 1...*

Instance level collaboration for usecase 3:

Instance level collaboration for usecase 4:


disp :
Display
details : Company
Details
factory :
Factory
sales :
Sales
cash : Cash
Account
:Machine
Class
:Loan
1: doMonthlyAccounts()
2: o_h =machineOverhead()
6: amount :=grossProfit()
7: adjustBank()
8: credit(new Profit())
4: adjustDuration()
5: repayment :=showRepayment()
3: o_h :=moverhead()

Specification level collaboration for usecase 4:
/UserDisplay :
Display
/CompanyDetails :
CompanyDetails
/ProductionFactor
y : Factory
/CompanyAccount :
CashAccount
:Loan
:Machine
Class
/SalesDetails :
Sales

Specification level collaboration diagram for usecase 5:


/UserDisplay : Display
/CompanyDetails :
CompanyDetails
/CompanyAccount :
CashAccount
/SalesDetails :
Sales
/MarketDetails :
Market
/ProductionFactor
y : Factory
/CompanyProduction :
Production





10. Cl ass RoomModel



11. Tel ephone Di al i ng
Sequence diagram :-
caller exchange talker
1: lift receiver
2: dialtone
3: dial digit
4: route
5: phone ring
6: ringing tone
7: answer phone
8: stop ringing
9: stop tone

Collaboration diagram:-


caller exchange
talker
1: lift receiver
2: dialing
3: dial digit 4: route
6: ringing tone
9: stop tone
5: phone rings
7: answer phone
8: stop ringing

Das könnte Ihnen auch gefallen