Core Objects & Relationships
Based on the requirements and use cases, identify the main objects of the system and analyze how they interact and relate to each other...
Bank account creation follows Factory creation method
- we will use interface and implement interface in class for money credited and debited
- interface for AccountOperations
- abstract class for BankAccount implements AccountOperations
- protected double balance
- LoanPolicy
- CreditCardoffer
- AccountState
- BankAccount constrcutor
- authenticate
- AccountState.authenticate
- blockAccount
- executeCommand(AccountCommand command)
- with savings and current account form following open closed principle
- class SavingAccount extends BankAccount
- constructor()
- LoanPolicy = new SavingLoanPolicy()
- CreditCardoffer = new SavingsCreditCardoffer()
- credit
- debit
- if balance is present, then only you can debit
- class CurrentAccount extends BankAccount
- constructor()
- LoanPolicy = new CurrentLoanPolicy()
- CreditCardoffer = new CurrentCreditCardoffer()
- credit
- debit
- if balance is null, still you can debit
- interface AccountFactory
- class SavingAccountFactory extends AccountFactory
- create
- return new SavingAccount();
- class CurrentAccountFactory extends AccountFactory
- create
- return new CurrentAccount();
- interface LoanPolicy
- SavingLoanPolicy extends LoanPolicy(class can extend class)
- CurrentLoanPolicy extends LoanPolicy
- interface CreditCardoffer
- SavingsCreditCardoffer extends CreditCardoffer
- CurrentCreditCardoffer extends CreditCardoffer
- interface AccountState
- class ActiveState implements AccountState
- ActiveState constructor(BankAccount account)
- authenticate(password)
- if password mismatch three times, call blockAccount()
- else active
- class BlockState implements AccountState
- ActiveState constructor(BankAccount account)
- authenticate(password)
- return RunTimeException timeout for 24 hrs to prevent fraud
- interface AccountCommand
- class ChangePassWord implements AccountCommand
- class AddCreditCard implements AccountCommand
- class RemoveCreditCard implements AccountCommand
- Main Class
- Call AccountFactory for SavingAccountFactory or CurrentAccountFactory