Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Taxi Management System: Use case diagram

Taxi joins rank

Taxi leaves rank

Taxi drops fare

View financial report


User

View transaction log

View taxi locations


Taxi Management System: Activity diagrams

Taxi joins rank Taxi leaves rank

Find taxi Find rank

[else] [else]

[rank found
[taxi not found]
and not empty]

Create taxi Remove front taxi


from rank

Add fare info to taxi

Check taxi location


Create Leave
and destination
transaction

[else]

[taxi on road
and no destination]

Find rank

[else]

[rank found and


space available] Taxi drops fare

Add taxi to rear of


rank

Create Join Find taxi


transaction

[else]

[taxi found
and on road]

Record whether
price was paid

Create Drop
transaction

View financial report View transaction log

Get all taxis Get all transactions

Calculate total
money paid to all
taxis

View taxi locations

Get all taxis


Taxi Management System: Analysis diagrams

Taxi
Manager

Taxi
1. Taxi joins rank
User
UI

User 6. Add taxi


Rank
Rank
Manager

9. Create
Transaction Join
Manager Transaction

3. Front taxi
takes fare 4. Add fare
Rank
Rank Taxi
Manager

1. Taxi leaves rank


User
UI

6. Create
User Transaction Leave
Manager Transaction

Taxi
Manager

3. Get location
1. Taxi drops fare 4. Drop fare
User
Taxi
UI

User

6. Create
Transaction Drop
Manager Transaction

Taxi
Manager
1. View financial
report
User
UI

User
Taxi

Transaction
Manager
1. View
transaction log
User
UI

User

Transaction

Taxi
Manager

3. Get number
4. Get location
1. View taxi
5. Get destination
locations
User 6. Get rank
UI Taxi

User

Rank
Taxi Management System: Class diagram Taxi
+ IN_RANK : string = "in rank"
+ ON_ROAD : string = "on the road"
- currentFare : double
- destination : string = ""
- location : string = ON_ROAD
TaxiManager - number : int
- rank : Rank
- taxis : SortedDictionary<int, Taxi> - totalMoneyPaid : double = 0
+ CreateTaxi(taxiNum:int) : Taxi + Taxi(taxiNum:int)
+ FindTaxi(taxiNum:int) : Taxi + AddFare(destination:string, agreedPrice:double) : void
+ GetAllTaxis() : SortedDictionary<int, Taxi> + DropFare(priceWasPaid:bool) : void
+ GetCurrentFare() : double
+ GetDestination() : string
+ GetLocation() : string
+ GetNumber() : int
+ GetRank() : Rank
+ GetTotalMoneyPaid() : double
+ SetRank(r:Rank) : void

UserUI
Program
- rankMgr : RankManager
- ui : UserUI
- taxiMgr : TaxiManager Rank
+ Main(args:string[]) : void - transactionMgr : TransactionManager
RankManager
- DisplayMenu() : void - id : int
+ UserUI(rkMgr:RankManager, - ranks : Dictionary<int, Rank>
- DisplayResults(results:List<string>) : void - numberOfTaxiSpaces : int
txMgr:TaxiManager,
- ReadDouble(prompt:string) : double + RankManager() - taxiSpace : List<Taxi>
trMgr:TransactionManager)
- ReadInteger(prompt:string) : int + AddTaxiToRank(t:Taxi, rankId:int) : bool
+ TaxiDropsFare(taxiNum:int, pricePaid:bool) : List<string> + Rank(rankId:int, numberOfTaxiSpaces:int)
- ReadString(prompt:string) : string + FindRank(rankId:int) : Rank
+ TaxiJoinsRank(taxiNum:int, rankId:int) : List<string> + AddTaxi(t:Taxi) : bool
- TaxiDropsFare() : void + FrontTaxiInRankTakesFare(rankId:int,
+ TaxiLeavesRank(rankId:int, + FrontTaxiTakesFare(destination:string,
- TaxiJoinsRank() : void destination:string,
destination:string, agreedPrice:double) : Taxi
- TaxiLeavesRank() : void agreedPrice:double) : Taxi
agreedPrice:double) : List<string> + GetId() : int
- ViewFinancialReport() : void
+ ViewFinancialReport() : List<string>
- ViewTaxiLocations() : void
+ ViewTaxiLocations() : List<string>
- ViewTransactionLog() : void
+ ViewTransactionLog() : List<string>

<<abstract>>
TransactionManager Transaction
- transactions : List<Transaction> - TransactionDatetime : DateTime
+ GetAllTransactions() : List<Transaction> - TransactionType : string
+ RecordDrop(taxiNum:int, pricePaid:bool) : void + Transaction(type:string, dt:DateTime)
+ RecordJoin(taxiNum:int, rankId:int) : void + GetTransactionDatetime() : DateTime
+ RecordLeave(rankId:int, t:Taxi) : void + GetTransactionType() : string
+ ToString() : string

DropTransaction JoinTransaction LeaveTransaction


- taxiNum : int - taxiNum : int - taxiNum : int
- priceWasPaid : bool - rankId : int - rankId : int
+ DropTransaction( + JoinTransaction( - destination : string
transactionDatetime:DateTime, transactionDatetime:DateTime, - agreedPrice : double
taxiNum:int, taxiNum:int, + LeaveTransaction(
priceWasPaid:bool) rankId:int) transactionDatetime:DateTime,
+ ToString() : string + ToString() : string rankId:int,
t:Taxi)
+ ToString() : string
Taxi Management System: Sequence diagrams

:Program :UserUI :TaxiManager :RankManager r:Rank t:Taxi :TransactionManager :JoinTransaction


Main()

TaxiJoinsRank()

TaxiJoinsRank()
FindTaxi()
t:Taxi

opt
CreateTaxi()
[taxi not found]
t:Taxi

AddTaxiToRank()

opt

[taxi is on road and FindRank()


it has no destination]

opt

[rank found] AddTaxi(t)

opt

[space available] SetRank()

b:bool

opt
RecordJoin()
[b is true]
JoinTransaction()

DisplayResults()

:Program :UserUI :RankManager r:Rank t:Taxi :TransactionManager :LeaveTransaction


Main()

TaxiLeavesRank()

TaxiLeavesRank()
FrontTaxiInRankTakesFare()

FindRank()

opt
FrontTaxiTakesFare()
[rank found and
is not empty] AddFare()

t:Taxi

t:Taxi

opt

[t is not null] RecordLeave()


LeaveTransaction()

DisplayResults()

:Program :UserUI :TaxiManager t:Taxi :TransactionManager :DropTransaction


Main()

TaxiDropsFare()

TaxiDropsFare()
FindTaxi()
t:Taxi

opt

[t not null and


DropFare()
taxi location is
on road and taxi
has a destination]
RecordDrop()
DropTransaction()

DisplayResults()

:Program :UserUI :TaxiManager t:Taxi


Main()

ViewFinancialReport()

ViewFinancialReport()
GetAllTaxis()

loop
GetTotalMoneyPaid()
[for each taxi]

DisplayResults()

:Program :UserUI :TaxiManager t:Taxi :Rank


Main()

ViewTaxiLocations()

ViewTaxiLocations()
GetAllTaxis()

loop
GetNumber()
[for each taxi]

GetLocation()

alt
GetDestination()
[taxi is on road]

[else] GetRank()
GetId()

DisplayResults()

:Program :UserUI :TransactionManager :Transaction


Main()

ViewTransactionLog()

ViewTransactionLog()
GetAllTransactions()

loop ToString()
[for each transaction]

DisplayResults()

You might also like