Page 185 - DCAP308_OBJECT_ORIENTED_ANALYSIS_AND_DESIGN
P. 185

Unit 14: Steps for Class Design




                                                                                                Notes
            At this stage, we need to add more information to these attributes, such as visibility and
            implementation type. Furthermore, additional attributes can be identified to enable
            implementation of the class:
            #firstName: String
            #lastName: String
            #pinNumber: String
            #cardNumber: String
            #account: Account (instance connection)
            To design the association between the BankClient and the Account classes, we need to add
            an account attribute of type Account, since the BankClient needs to know about his or her
            account and this attribute can provide such information for the BankClient class. This is an
            example of instance connection, where it represents the association between the BankClient
            and the Account objects. All the attributes have been given protected visibility.
            Refining Attributes for the Account Class
            Here is the refined list of attributes for the Account class:
            #number: String
            #balance: float
            #transaction: Transaction (This attribute is needed for implementing the association between
            the Account and Transaction classes.)
            #bankClient: BankClient (This attribute is needed for implementing the association
            between the Account and BankClient classes.)

            At this point we .must make the Account class very general, so that it can be reused by the
            checking and savings accounts.
            Refining Attribute for the Transaction Class

            The attributes for the Transaction class are these:
            #transID: String
            #transDate: Date
            #transTime: Time
            #transType: String
            #amount: float
            #postBalance: float
            Refining Attributes for the ATM Machine Class
            The ATM Machine class could have the following attributes:
            #address: String
            #state: String
            Refining Attributes for the CheckingAccount Class

            Add the savings attribute to the class. The purpose of this attribute is to implement the
            association between the CheckingAccount and SavingsAccount classes.

                                                                                 Contd...





                                           LOVELY PROFESSIONAL UNIVERSITY                                   179
   180   181   182   183   184   185   186   187   188   189