You are on page 1of 16

Case Study: ATM machine II

Identifying Class Attributes

Amalia Foka
CEID - University of Patras
Object Oriented Programming II (C++)
Fall 2010-2011
Attributes & Operations
 Classes have
 attributes (data) and
 operations (behaviors).
 Class attributes implemented as
 data members
 Class operations implemented as
 member functions
Attributes – Real World Examples
 Person
 height
 weight
 left-handed
 Radio
 Frequency tuned
 Volume
 Band (AM or FM)
Attributes – Requirements Document
 Identify Attributes
 look for descriptive words and phrases
in the requirements document
 assign it to one or more of the classes
identified
 create attributes to represent any
additional data that a class may need
Descriptive words and phrases from
the ATM requirements
ATM Class
 userAuthenticated
 boolean

 Indicates whether the ATM has


successfully authenticated the
current user
 userAuthenticated must be true
 for the system to allow the user to
perform transactions
 access account information
 this attribute helps ensure the security
of the data in the system.
ATM Class
 userAuthenticated
 boolean

 Indicates whether the ATM has


successfully authenticated the
current user
 userAuthenticated must be true
 for the system to allow the user to
perform transactions
 access account information
 this attribute helps ensure the security
of the data in the system.
ATM Class
 userAuthenticated
 boolean

 Indicates whether the ATM has


successfully authenticated the
current user
 userAuthenticated must be true
 for the system to allow the user to
perform transactions
 access account information
 this attribute helps ensure the security
of the data in the system.
BalanceInquiry Class
 accountNumber
 integer

 Each transaction involves an


"account number" that corresponds
to the account of the user making
the transaction
BalanceInquiry Class
 accountNumber
 integer

 Each transaction involves an


"account number" that corresponds
to the account of the user making
the transaction
Withdrawal Class
 accountNumber
 integer
 amount
 double

 users must enter a specific


"amount" of money to be withdrawn
Deposit Class
 accountNumber
 integer
 amount
 double

 users must enter a specific


"amount" of money to be deposited
Account Class
 each bank account has an
 "account number" and
 "PIN,"
 used for identifying accounts
and authenticating users

 "balance" of the amount of money in the


account
 The money the user deposits does not become
available for a withdrawal until the bank verifies
it.
 availableBalance tracks the amount of money
that a user can withdraw from the account
 totalBalance refers to the total amount of money
that the user has "on deposit"
CashDispenser Class
 count
 integer

 the cash dispenser "begins each day


loaded with 500 $20 bills“
 keep track of the number of bills it
contains to determine whether
enough cash is on hand to satisfy
withdrawal requests
Screen, Keypad, DepositSlot Class

 our design process has not yet revealed


any attributes
 At early stages in the design process,
classes often lack attributes (and
operations). Such classes should not be
eliminated, however, because attributes
(and operations) may become evident in
the later phases of design and
implementation.
BankDatabase Class

 class BankDatabase participates in a


composition relationship with zero or
more Account objects
 Software developers typically model
these whole/part relationships as
compositions rather than as attributes
required to implement the relationships

You might also like