PRG 420 Discussion Question # 2
Super class: The super of the class SavingsAccount would be Accounts, since there are many kinds of accounts, the class Accounts will store the basic values that are common in all the accounts such as a unique account number. Sub class: The subclasses of class SavingAccount will be PassbookSavings ad CertificateOfSavings, since these two accounts are types of saving accounts therefore we have made them the subclasses of SavingAccount. Attribute: There will be many attributes in SavingAccount class, one of them will be interest, because the interest of a SavingsAccount is compund therefore it will be dealt in the SavingsAccount class. Method: One method in the SavingsAccount class will be calcInterest(), this method will calculate the compound interest. Instance: An instance will be formed for every new account holder, this instance will keep all the information and will carry out the primary tasks as required. Encapsulation: Encapsulation is defined as the hiding of data in a class so that it is not accessed by any other class. Mostly classes are designed in a way that the secret/important data is not accessible to any other class. The important attribute here is the interest, if interest is modified by any means then it can cause trouble for account-holder and bank. So this attribute will be well encapsulated in the class SavingsAccount.
http://www.studentoffortune.com/question/1880165/PRG-420-Discussion-Question--2
No comments:
Post a Comment